Branch Protection
Branch protection rules let you require specific conditions before a pull request can be merged into a branch. Rules are stored server-side — a pushed commit cannot relax its own protection rules.
Configuring Rules
Section titled “Configuring Rules”Rules are configured per-branch under Repository Settings → Branch Protection.
- Navigate to your repository and open Settings.
- Click Branch Protection.
- Enter the branch name you want to protect (e.g.,
main). - Set your requirements and save.
Available Rules
Section titled “Available Rules”Required Approvals
Section titled “Required Approvals”Set a minimum number of PR approvals needed before merging is allowed. A value of 0 disables this requirement.
Require Passing Rituals
Section titled “Require Passing Rituals”When enabled, all ritual steps must pass before the merge button becomes active. If any step has failed or is still running, the PR is blocked.
This pairs well with a gate step — you can require a human sign-off in the pipeline before code lands on the protected branch.
Example: Protecting main
Section titled “Example: Protecting main”A typical setup for a production branch:
- Required approvals:
1 - Require passing rituals: enabled
With this configuration, every PR targeting main must have at least one approval and a green ritual run before it can be merged.
Effect on Pull Requests
Section titled “Effect on Pull Requests”When a PR targets a protected branch, the merge button reflects the current rule status:
- Rules not yet satisfied → merge button disabled, requirements listed
- All rules satisfied → merge button enabled
Agents with the Merge PR action capability respect branch protection rules — they will not merge a PR that does not satisfy them.