ci(branch-protection): self-heal + protect release tags#105
Merged
Conversation
Add a scheduled self-healing workflow that re-asserts main branch protection across the org, and extend the script to protect immutable release tags. - branch-protection-heal.yml: weekly cron + workflow_dispatch, runs the script with an admin PAT (BRANCH_PROTECTION_PAT), fails fast with an actionable message if the secret is unset. - Tag protection via a repository ruleset (the classic tag-protection API was retired). Targets dotted tags (refs/tags/v*.*, e.g. v2.4, v0.2.7) so the moving bare-major aliases (v1/v2) the shared-actions release flow re-points stay mutable; blocks deletion + non-fast-forward. - Per-repo OK / SKIPPED(archived) / FAILED classification; exits non-zero only on genuine failure so an archived repo no longer breaks the run. - Reconciliation report enumerates non-archived public org repos and flags any not enrolled (dynamic discovery, explicit enrollment). Refs #94
CameronBrooks11
enabled auto-merge (squash)
July 4, 2026 03:20
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.
Delivers the self-healing branch protection + release-tag protection from #94.
What
branch-protection-heal.yml— weekly cron (0 6 * * 3) +workflow_dispatch. Runsapply-branch-protection.shwith an admin PAT so drift is re-asserted, not just reported. Fails fast with an actionable message if the secret is missing.protect-version-tags). The classic tag-protection REST API was retired by GitHub (404), so rulesets are the vehicle (free on public repos). Blocks deletion + force-push (non_fast_forward); creation of new release tags stays allowed.OK/SKIPPED (archived)/FAILED; exits non-zero only on a genuine failure, so an archived repo no longer breaks the run (the operator-ui breakage from chore: drop archived anolis-operator-ui from branch-protection list #95).REPOS.Design decisions (called out for review)
refs/tags/v*.*(dotted), notv*. The shared-actions release flow re-points the moving bare-major aliasesv1/v2withgit tag -f; av*+non_fast_forwardrule would block that and break org-wide action pinning. Immutable release tags always carry a dot (v2.4,v0.2.7); the aliases never do — sov*.*protects exactly the tags that must never move and leaves the aliases free. This also means no bypass actor is needed.REPOSallowlist for enforcement; dynamicgh repo listfor reporting only. Full dynamic enrollment would risk permanently blocking PRs on a repo whose CI doesn't yet expose the requiredokcheck.Validation
shellcheckclean;bash -nOK;--dry-runverified.v*.*payload (test rulesets cleaned up).Remaining owner step (activation)
This ships the mechanism. It activates once you provision the
BRANCH_PROTECTION_PATsecret (fine-grained PAT, Administration: read/write on allanolishqrepos) — see the README. After that I can trigger the firstworkflow_dispatchrun and monitor it. Leaving #94 open until activated.Refs #94