Reputation: 349
For a python application, I have setup a GitHub action that runs pytest (and other tools) on each pull request to master.
When the workflow fails, I saw it in the "Check" tab on the pull request page, but I can merge my branch even if the GitHub action fails:
In my repository, settings -> branches, I created a new protection rules that matches my need, but I can't specify any status check.
All I want to do is to use my workflow to allow (or forbid) a Pull Request to be merged according to the workflow's output.
Any ideas?
Upvotes: 8
Views: 3659
Reputation: 349
Ok so the right answer is pretty straightforward but it is not documented:
When creating a branch protection rule, you must check Require status checks to pass before merging
(that's what I did), AND (that's what I did not) you MUST add a status check by searching it in the search bar.
If nothing appears, it's normal. You have to search the status check, it's the name of your job on your GitHub Action !
Upvotes: 10