GitHub lets you convert all branch protections to rulesets in one action
GitHub added a one-click import that converts all of a repository's branch protection rules to rulesets, with a preview step and a choice to keep or delete the originals.
GitHub now lets you convert every branch protection rule in a repository to rulesets in a single action, the company announced on October 20. The feature extends the earlier ability to convert one rule at a time, which GitHub says now allows for at-scale conversions.
To use it, open Settings → Rulesets in your repository and click Import branch protection rules. The Review import dialog is where most of the work happens before anything is created.
Preview before you commit
In the dialog you can preview the rulesets that will be created before confirming. You can also see which branch protection rules are already covered by an existing ruleset, so you don’t duplicate policy that’s already in place.
GitHub also flags the cases where a single branch protection rule produces multiple rulesets to preserve its original behavior. You then choose an enforcement status — Active, Evaluate or Disabled — and select which rulesets to create.
After clicking Create rulesets, you decide whether to keep or delete the original branch protection rules. That last step matters if you want a fallback while you check that the new rules behave as expected.
Why GitHub wants you on rulesets
According to GitHub, rulesets offer several advantages over classic branch protections:
- Rules can be applied across multiple branches with pattern matching.
- Multiple rulesets can be layered for granular policy control.
- Rulesets can be managed at the organization or enterprise level.
- Bypass permissions can be configured at a fine-grained level for users, teams and apps.
Those points come from GitHub’s changelog; the company has not published independent benchmarks comparing the two systems.
Availability
The bulk conversion is available for all repositories where rulesets are available. If your repository already uses rulesets, the import dialog will show you which protections are covered before you create anything new. GitHub points to its documentation on converting branch protections to repository rulesets for the full walkthrough.
Sources
- Bulk migrate branch protections to rulesets for a repository — GitHub Changelog
Some links on this page may be affiliate links. If you buy through them we may earn a commission at no extra cost to you. See our affiliate disclosure.