Skip to content

ci: make release tags immutable, as in substrate-gke - #24

Merged
MushuEE merged 1 commit into
ci/rulesets-as-codefrom
ci/rulesets-immutable-tags
Nov 18, 2026
Merged

MushuEE merged 1 commit into
ci/rulesets-as-codefrom
ci/rulesets-immutable-tags

Conversation

@MushuEE

@MushuEE MushuEE commented Nov 18, 2026

Copy link
Copy Markdown
Contributor

Part of #14, under the release epic #12. Stacked on #23.

What

Aligns tag protection with how ai-on-gke/substrate-gke is set up: two rulesets, so a release tag can't be changed once it exists.

Ruleset Rules Who can bypass
protect-tags-create Tags can't be created. Repository admins
protect-tags-immutable A tag can't be moved or deleted, and its name must match vMAJOR.MINOR.PATCH[-PRERELEASE]. Nobody

They replace the single protect-tags ruleset.

What changes in practice

  • Admins can no longer move or delete a tag. Today they can, because they bypass all of protect-tags. A published release tag then always points at the commit its images were built from.
  • The tag name pattern now applies. Today admins bypass it, and admins are the only ones who can create tags, so it never takes effect. substrate-gke has no name pattern; I kept ours and moved it to the ruleset with no bypass.
  • Who can create a tag doesn't change: repository admins only.

One thing to be aware of: a tag pushed by mistake can no longer be deleted without first editing the ruleset.

After merge

Nothing is applied yet. A repo admin runs:

scripts/apply-rulesets.sh --dry-run
scripts/apply-rulesets.sh

and then deletes the old protect-tags ruleset under Settings → Rules → Rulesets. The script never deletes a live ruleset. Creating the new ones first means tags are never left unprotected.

Testing

scripts/apply-rulesets.sh --dry-run on this branch:

=== Protect main: up to date
=== protect-tags-create: not on GitHub; would create it from .github/rulesets/protect-tags-create.json
=== protect-tags-immutable: not on GitHub; would create it from .github/rulesets/protect-tags-immutable.json
=== protect-tags: on GitHub (id 27504922) but has no file; not deleting it

The rulesets workflow only runs for pull requests into main, so it will run here once #23 merges and this is retargeted.

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.
@MushuEE MushuEE added this to the Milestone v0.0.0 milestone Nov 18, 2026
@MushuEE MushuEE self-assigned this Nov 18, 2026
@MushuEE MushuEE mentioned this pull request Nov 18, 2026
5 of 6 tasks
@MushuEE
MushuEE merged commit 44c46eb into ci/rulesets-as-code Nov 18, 2026
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant