Repository navigation
Conversation
…ue#484) The default branch had neither a ruleset nor a classic branch-protection rule, so a mistaken direct push or force-push could bypass review and reintroduce unsafe history. Record the applied `Protect main` ruleset — pull-request-only merges, one approving review with stale approvals dismissed, the always-on CI checks, blocked force pushes and deletions, and admin-only bypass — so the setting is auditable and reproducible upstream. Closes Sub-Rosa-Issue#484 🤖 Generated with Codebuff Co-Authored-By: Codebuff <noreply@codebuff.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Closes #484.
mainhad no protection at all — the ruleset list was empty andGET /repos/{owner}/{repo}/branches/main/protectionreturned404 Branch not protected— so a mistaken direct push or force-push could bypassreview and reintroduce unsafe history.
This PR creates an active repository ruleset named
Protect mainon thedefault branch and records the final settings in
docs/BRANCH_PROTECTION.md.No source code, workflow, or dependency changes are included.
Ruleset
Protect main/25968240branchactiveref_name.include = ["~DEFAULT_BRANCH"](resolves tomain, follows renames)Acceptance criteria → settings
pull_requestrulerequired_approving_review_count: 1dismiss_stale_reviews_on_push: truerequired_status_checks:check,coverage,round-contract,webnon_fast_forwardruledeletionruleRepositoryRoleadmin (actor_id: 5)Required status checks
Contexts are the GitHub Actions job names. Five workflows gate every PR
through four contexts, because
Bindings checkandLine lengths checkbothname their job
check. GitHub matches checks by context name and requires allruns sharing a context to pass, so
checkcovers both:checkbindings-check.yml(Bindings check)checkcheckline-lengths.yml(Line lengths check)checkcoveragecoverage.yml(TypeScript coverage)coverageround-contractcontract.yml(Contract tests)round-contractwebweb.yml(Web checks)webDeliberately not required:
Docs link check(check-links) andEnvironment template check(validate) are scoped withon: pull_request: paths:. GitHub keeps a required check from a path-filteredworkflow in
Pendingwhen the paths don't match, which would block everyunrelated PR indefinitely. They remain advisory until they run on every PR.
Bypass: exactly one actor — the repository admin role. No users, teams,
apps, deploy keys, or the
write/maintainroles can bypass, keeping anemergency escape hatch without widening bypass access.
Where it is applied
The ruleset is applied and verified on
timo126/sub-rosa-issue, which is therepository where the automation account holds
admin. The upstreamSub-Rosa-Issue/sub-rosa-issuereportspermissions.admin = falsefor the sametoken, so an org admin must apply the identical payload there:
gh api --method POST repos/Sub-Rosa-Issue/sub-rosa-issue/rulesets --input ruleset-main.json(the full JSON is in
docs/BRANCH_PROTECTION.md).Verification
That endpoint only returns rules from rulesets with
active/evaluateenforcement, so it is direct evidence that merges into
mainnow require anapproved, CI-green pull request and that force pushes and deletions are blocked.
Live ruleset page: https://github.com/timo126/sub-rosa-issue/rules/25968240.
Supply-chain review
.vscode/, workflow, or other editor/config file changes.preinstall/postinstall) was added.Testing
(
GET /repos/timo126/sub-rosa-issue/rulesets/25968240) — the recorded JSON indocs/BRANCH_PROTECTION.mdis that response verbatim.mainwithGET /repos/timo126/sub-rosa-issue/rules/branches/main.actually reports (
GET /repos/Sub-Rosa-Issue/sub-rosa-issue/commits/main/check-runs).node scripts/check-links.js→OK 43 local link(s) checked, 0 allowlisted.node scripts/check-line-lengths.mjs→ pass (longest new line: 109 chars).Docs link checkis the only changed-pathworkflow that applies to this PR.
Closes #484