Rulesets (rather than the legacy method of Branch protection rules) should be used to apply branch protection and CI status check rules to a repo.
Some of the GitHub Apps we use (eg GHA Scala Library Release Workflow) require the ability to bypass branch protection restrictions, and it is only possible to grant this when using GitHub Rulesets.
Recommended Rulesets are listed below:
We have a ruleset for this defined at the GitHub-org level which can be automatically applied to your repo:
- Edit the Custom Property
production_statuson your repo to selectproduction(note, this step requires GitHub-org-owner privileges). This will enable the organisation-level ruleset on your repo which applies branch protection to the default branch. (N.B. This ruleset is configured to allow the 'Gu Scala Library Release' app to bypass the branch protection.)
Unfortunately this ruleset can't be defined at the org-wide level, so you must manually create it yourself:
- Create a ruleset in your repo with the 'Branch protection' property: 'Require status checks to pass' -> 'Require branches to be up to date before merging'.
- Type your CI workflow's job name(s) into the 'Status checks that are required' box.
- Add relevant GitHub apps (e.g. 'Gu Scala Library Release') to the ruleset bypass list.

