Required status checks ensure that all required CI tests are passing before collaborators can make changes to a protected branch.
If you've enforced branch protections in your repository, you can set up required status checks. These checks must pass before branches can be merged into the protected branch. Any commits must either be pushed to another branch and then merged or pushed directly to the protected branch after all required status checks have passed.
Once you've set up required status checks, your branch must be up to date with the base branch before merging. This ensures that your branch has been tested with the latest code from the base branch. If your branch is out of date, you'll need to merge the base branch into your branch.
Note: You can also bring your branch up to date with the base branch by using Git rebase.
You won't be able to push local changes to a protected branch until all required status checks pass. Instead, you'll receive an error message similar to the following:
remote: error: GH006: Protected branch update failed for refs/heads/master. remote: error: Required status check "ci-build" is failing
Note: Pull requests that are up to date and pass required status checks can be merged locally and pushed to the protected branch. This can be done without status checks running on the merge commit itself.
Administrators of a repository can merge a protected branch even if required status checks have failed or are pending. You can require administrators to be subject to required status checks.
Administrators can also merge a protected branch even if the branch is out of date with the base branch.