GitHub PR mergeability
As you can see in the above screenshot, my last commit in this PR deliberately fails the CI flow in Drone and we can see the "All checks have failed" warning. But this PR is still mergable (even by a non-admin user).
Most of the time, we want to block pull requests that don't pass status checks from merging into master branch. GitHub provides a great feature called Branch protection rule to achieve this goal (doc).
Create a Branch Protection Rule
This function is located in repository Settings > Code and automation > Branches > Add rule
Let's create the rule as below:
Notice that the Branch name pattern field, the value shouldn't contain any white space. Otherwise, you'll get a invalid rule error message.
Now we have a rule to block PR with failing status.
By checking the Include administrators
option, the restrictions will be applied to administrators too.