docs: add branch-protection checklist for required CI checks on main#32
docs: add branch-protection checklist for required CI checks on main#32naimkatiman merged 1 commit intomainfrom
Conversation
Adds docs/branch-protection-checklist.md as a one-shot paste-and-click reference for lifting the CI lints from advisory to required on the main branch. Covers the UI path (Settings → Branches), the gh api equivalent for CLI users, the verification step (look for "Required" badges on an open PR), and the reverting path. Names the four required checks that need to be added (test 18/20/22, lint-transcript) and explains that the skill-mirror, docs-substrings, and 7-laws lints all run inside the test job so making test required covers all three with a single setting. Closes the natural end of the rule-then-lint discipline arc shipped across PRs #27, #28, #30, #31 — three lints landed but none required until this UI change is applied. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
There was a problem hiding this comment.
Code Review
This pull request introduces a new documentation file, docs/branch-protection-checklist.md, which provides a detailed guide for setting up branch protection on the main branch using both the GitHub UI and the CLI. The feedback points out two critical issues in the instructions: the GitHub UI does not allow setting the required number of approvals to zero when pull requests are mandatory, and the API payload in the CLI example will fail because the approval count must be between 1 and 6. A suggestion was provided to set the review requirement to null in the API call to resolve this.
| - [ ] **Require a pull request before merging** | ||
| - Sub-option: **Require approvals: 0** (single-maintainer repo; raise later if you take on collaborators) |
There was a problem hiding this comment.
In the GitHub UI, if Require a pull request before merging is enabled, the Required number of approvals before merging must be at least 1. It cannot be set to 0. For a single-maintainer repository, it is generally recommended to leave Require a pull request before merging unchecked and only enable Require status checks to pass before merging. This allows you to merge your own PRs once CI passes without needing a second account for approval.
| "required_pull_request_reviews": { | ||
| "required_approving_review_count": 0, | ||
| "dismiss_stale_reviews": false, | ||
| "require_code_owner_reviews": false | ||
| }, |
There was a problem hiding this comment.
The GitHub API will return a 422 Unprocessable Entity error if required_approving_review_count is set to 0, as the valid range is 1-6. To disable the requirement for approvals while still using the protection endpoint, set required_pull_request_reviews to null.
| "required_pull_request_reviews": { | |
| "required_approving_review_count": 0, | |
| "dismiss_stale_reviews": false, | |
| "require_code_owner_reviews": false | |
| }, | |
| "required_pull_request_reviews": null, |
Summary
mainbranchWhy now
This session shipped three CI lints across PRs #28, #30, and #31 that all enforce different correctness rules — but none are currently required on
main. The merge button is enabled regardless of whether the lints pass. The checklist closes that gap with a one-time GitHub-UI configuration that takes ~2 minutes.The doc covers:
main) with the exact boxes to tickgh apiPUT with a JSON body, since branch-protection nested fields are awkward via--fieldflags)gh api -X DELETEtestis required, and references the session demonstration where PR feat(ci): add skill-mirror lint enforcing CONTRIBUTING.md mirror rule #28 had a redtest (20)and the merge button still offered to mergeRequired checks proposed
test (18)testmatrix on Node 18test (20)testmatrix on Node 20test (22)testmatrix on Node 22lint-transcriptlint-transcriptjobbin/lint-transcript.mjsruns without errorsThe skill-mirror, docs-substrings, 7-laws, and instinct-pack-JSON lints all live as steps inside the
testjob, so makingtest (N)required for each Node version covers all four with a single setting.What this PR does NOT do
gh apiif you prefer).Test plan
gh pr checks <PR>lists them with the names GitHub uses internally)main, then open a fresh PR (or push a commit to an existing branch) and confirm all four checks show Required badges before mergingPR scope discipline
Following all rules in CONTRIBUTING.md:
assert.matchondocs/branch-protection-checklist.mdexists.Out of scope (intentionally)
🤖 Generated with Claude Code