Skip to main content
Managing status check rules in GitHub

How to enable or disable the requirement for Gearset-related status checks to pass before merging a pull request in GitHub

Gabriel Cowley avatar
Written by Gabriel Cowley
Updated over 2 months ago

Gearset's status check integration with GitHub allows you to control when pull requests can be merged, based on the results of the CI job.

How does it work?

Gearset's status check integration works with any CI job that uses a GitHub repository as the source of the deployment.

Whenever the job runs, Gearset will automatically post the build status (succeeded or failed) back to GitHub, referencing the relevant git commit and the outcome of the job (success or failure).

This gives you direct insight into the status of a related CI job from within GitHub, without looking up the results in Gearset. 

If required status checks are enabled in your repository settings, it can also help ensure that GitHub pull requests are not merged until everything is in order and the CI job can successfully run the validation or deployment. 

How are required status checks set up in GitHub?

The instructions below show you how to enable or disable required status checks for your GitHub repository.

  1. Navigate to the Settings page of your GitHub repository.

  2. In the left-hand menu, click Branches.

  3. Under Branch protection rules, either click Edit for a rule that you would like to change, or click Add rule at the top to create a new rule (depending on the branches you wish to cover).

  4. If adding a new rule, enter the desired branch name in the Apply rule to field.

  5. To enforce the status checks rule, check Require status checks to pass before merging in Rule settings.

    1. Note: as explained here, the extra setting for Require branches to be up to date before merging will automatically tick when you enforce status check rules. On PRs it would show up with the following behaviour. We recommend turning this off if using Gearset Pipelines as the target branch is only usually pulled down into the source if you've resolved a merge conflict, so you may encounter erroneous blocking of feature branches unnecessarily if you only want to enforce that Gearset Validation has passed.

  6. If Gearset has posted a build status to the repository in the last week, you should be able to search for Gearset in that text box and find the right CI Job Name you wish to align to this branch (e.g Main > Production CI job aligns to the 'main' branch in GitHub as an enforced check). Check or uncheck this item depending on whether you want Gearset build statuses to control whether a PR can be merged or not.

  7. Repeat steps 3 > 6 for all branches you wish to enforce protections on.

Did this answer your question?