Closed
Labels
Description
Summary
Replace the two overlapping rulesets on main with one ruleset, protect-main, that holds every rule for the default branch.
Current state
| Ruleset | Target | Rules |
|---|---|---|
main |
~DEFAULT_BRANCH |
deletion |
main: require PR review and CI |
~DEFAULT_BRANCH |
non_fast_forward; pull_request (1 approval, merge methods merge/squash/rebase, dismiss_stale_reviews_on_push: false); required_status_checks (build-and-test) |
Problems:
- To see the full policy for
main, you have to read two rulesets. - The ruleset allows the
mergemethod, but the repo settings disable merge commits (allow_merge_commit: false). The two disagree.
Proposal
Create one protect-main ruleset on ~DEFAULT_BRANCH containing:
deletionnon_fast_forwardpull_request:required_approving_review_count: 1allowed_merge_methods: ["squash", "rebase"], matching the repo settings- Leave
dismiss_stale_reviews_on_pushunchanged here. Changing it is tracked in its own sub-issue, "Clear approvals on fresh commits".
required_status_checks:build-and-test, unchanged
This change doesn't make the policy stricter, apart from removing the merge method that the repo settings already disable. Stricter rules (stale-approval dismissal, merge queue, more required checks) come in later sub-issues of this epic.
Rollout
- Create
protect-maininevaluatemode, next to the two existing rulesets. - Check the rule insights to confirm it evaluates the same way as the existing rulesets.
- Switch
protect-maintoactive, then deletemainandmain: require PR review and CI.
If #547 (Manage repository rulesets as code) lands first, this should land as .github/rulesets/protect-main.json and be applied with the script.
Acceptance criteria
- Exactly one active branch ruleset (
protect-main) targetsmain -
protect-maincontains deletion, non-fast-forward, pull request (1 approval, squash or rebase) and thebuild-and-testrequired check - The old
mainandmain: require PR review and CIrulesets are deleted - Merging a PR still works with squash and rebase
Activity
ci: manage repository rulesets as code and combine the main rulesets (g…