Repository navigation
ci: manage repository rulesets as code - #23
Merged
Merged
Conversation
Keep the repository rulesets in .github/rulesets/ so a change to branch or tag protection is proposed and reviewed like any other change. - Export the two live rulesets, "Protect main" and "protect-tags", as they are today. Nothing about what is enforced changes. - Add scripts/apply-rulesets.sh to apply the files (matched by name), show differences (--dry-run), check for drift (--check) and export (--export). - Add the rulesets workflow: a dry run on pull requests that touch the rulesets, and a daily drift check. - Document the rulesets and how to change them in docs/rulesets.md. Ported from google/ax (hack/apply-rulesets.sh, google/ax#572). Part of #14.
5 of 6 tasks
Split tag protection into the two rulesets ai-on-gke/substrate-gke uses: - protect-tags-create: tags can't be created, except by repository admins. - protect-tags-immutable: once created, a tag can't be moved or deleted by anyone, including admins. The tag name pattern (vMAJOR.MINOR.PATCH[-PRERELEASE]) moves to the ruleset with no bypass. In the single protect-tags ruleset, admins could bypass it, and admins are the only ones who can create tags, so it never applied. After merge, an admin runs scripts/apply-rulesets.sh to create the two rulesets, then deletes the old protect-tags ruleset in the repository settings. Part of #14.
Lukeluds
previously approved these changes
Nov 18, 2026
ci: make release tags immutable, as in substrate-gke
Lukeluds
approved these changes
Nov 18, 2026
11 of 12 tasks
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.
Part of #14, under the release epic #12.
What
Keeps the repository rulesets in the repo, so a change to branch or tag protection is proposed and reviewed like any other change. Ported from google/ax (google/ax#572).
.github/rulesets/: the two live rulesets,Protect mainandprotect-tags, exported as they are today. Nothing about what is enforced changes.scripts/apply-rulesets.sh: applies the files to GitHub, matched by name.--dry-runshows differences,--checkfails on drift,--exportwrites the live rulesets to the files. It never deletes a live ruleset.rulesetsworkflow: a dry run on pull requests that touch the rulesets, and a daily drift check.docs/rulesets.md: what is enforced and how to change it.What is enforced today
Protect mainmainLicense headerscheck must pass.protect-tagsvMAJOR.MINOR.PATCH[-PRERELEASE].So release tags are already limited to repository admins, which is what the release workflow (#13) needs before it publishes.
After merge
Nothing to apply: the files match what is live. From then on, a ruleset change is a pull request to these files, followed by an admin running
scripts/apply-rulesets.sh.Testing
scripts/apply-rulesets.sh --exportwrote both files from the live rulesets, and--checkright after reports both as up to date.scripts/verify/boilerplate.shpasses.