Print Warnings Github Actions - Pull Request

I just got started with Github Actions and implemented an action that compiles a Sphinx documentation on pull_request opened. Despite the script printing Warnigns visible in the github actions tab, I would like warnings and error to be printed directly inside the pull request, so that every contributer can immediatly fix their mistake. Right now the checks look green, despite the PR having issues.

From the github actions tab:
Screenshot 2021-08-13 at 21.35.04

The pull request page:
Is all green and says “All checks have passed”

sphinx-build supports command line options that can help you:
You can turn warnings into errors with the -W flag, but that will stop the build at the first warning. You should also set the --keep-going flag to continue on warnings but exit with an error code at the end.

You could also add another action to your workflow file that, if you detected warnings, would write those as a comment back to the pull request that triggered the workflow. Then you are able to surface those warnings, even if the workflows passes.

1 Like

There is a flag -w to write warnings and errors to a file (in addition to printing them to stderr) which might be helpful: sphinx-build — Sphinx documentation

You could use github-script to comment on the PR, using the content of that file.

awesome. thank you! I will try this out.