Skip to content

ci: protect release tags and release branches - #574

Merged
MushuEE merged 1 commit into
rulesets/2-fresh-approvalsfrom
rulesets/3-release-refs
Nov 13, 2026
Merged

MushuEE merged 1 commit into
rulesets/2-fresh-approvalsfrom
rulesets/3-release-refs

Conversation

@MushuEE

@MushuEE MushuEE commented Nov 12, 2026

Copy link
Copy Markdown
Collaborator

Summary

Adds two rulesets, both in evaluate mode, so release refs can only change through the release process. Stacked on #573. Review only the top commit.

Changes

  • .github/rulesets/protect-tags.json, on all tags:
    • Blocks creation, update, deletion and force-push for everyone except repo admins (RepositoryRole 5). Today that's @rakyll, who has cut every release so far, plus @mayawang and google-admin.
    • Requires names to match ^v\d+\.\d+\.\d+(-[0-9A-Za-z.-]+)?$.
    • It targets ~ALL rather than only v*, which also keeps ad-hoc tags off upstream. All 7 existing tags (v0.1.0–v0.3.1) already match the pattern.
  • .github/rulesets/protect-release-branches.json, on refs/heads/release-*: the same rules as protect-main (no deletion or force-push, PR with 1 approval, stale approvals dismissed, build-and-test), without a merge queue. No release-* branches exist yet.
  • go.yml now also runs on push and pull_request for release-*. Otherwise build-and-test never reports on release-branch PRs, and the required check can never pass.
  • docs/rulesets.md: adds the branch and tag naming rules (only main and release-X.Y are long-lived; tags are vX.Y.Z[-pre]). AGENTS.md is updated to match.

Open questions

  • Release managers: should anyone besides repo admins be able to create tags? Once the tag-driven release workflow lands (Epic 5), its identity should be added to bypass_actors.
  • Approvals on release branches: this PR uses 1. Substrate uses 0 because its cherry-picks are bot-driven.
  • Who can create release-* branches: this PR doesn't restrict creation. We could add a creation rule with an admin bypass.

After merge (repo admin)

  1. Run hack/apply-rulesets.sh. The new rulesets are created in evaluate mode.
  2. Watch Settings → Rules → Insights for about a week. Then switch both to "enforcement": "active" in a follow-up PR.
  3. Branch cleanup (Manage rulesets as code and protect release tags and branches #547):
    • Turn on Automatically delete head branches (delete_branch_on_merge).
    • Delete upstream branches whose PRs are merged or closed. PRs are squash-merged, so git branch --merged finds only 1 of the 62. Check PR state instead.

Part of #547.

Add two rulesets, both starting in evaluate mode:

- protect-tags: on all tags, block creation, update, deletion and
  force-push for everyone except repo admins, and require names to match
  ^v\d+\.\d+\.\d+(-[0-9A-Za-z.-]+)?$. Targeting all tags, not only v*,
  also keeps ad-hoc tags off the repo.
- protect-release-branches: on release-* branches, the same rules as
  protect-main (no deletion or force-push, PR with 1 approval, stale
  approvals dismissed, build-and-test).

Run go.yml on release-* branches too, so build-and-test reports on
release-branch PRs and the required check can pass.

Document the branch and tag naming rules in docs/rulesets.md.

Part of #547.
@MushuEE
MushuEE merged commit d9796e4 into rulesets/2-fresh-approvals Nov 13, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants