Repository navigation
fix(release): stop the release policy from deleting pipeline-cut releases - #23669
Merged
Merged
Conversation
…ases The policy judged a release by who created the release object. Cut Release reuses an existing draft, so a CI-built v1.4.216 whose draft a person had created was deleted (tag included) when its notes were edited, and Latest fell back to v1.4.214 because v1.4.215 was also published by a person. - Authorize a desktop release when its annotated tag was created by the release pipeline and points at its `release: vX` commit, not only by author. - Only delete on `published`; an edit never deletes a release or tag. - Pick Latest from the highest authorized stable using the same check. - Move the policy into config/scripts/release-policy.mjs with tests.
Release events run the workflow file from the tag's commit, so checking out the default branch could pair an old workflow with a newer module.
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.
ELI5
A GitHub workflow is supposed to delete stray releases that people publish by hand. It decided "stray" by asking who created the release entry, not whether our release pipeline actually built it. So a real, CI-built release got deleted just because someone edited its notes, and "Latest" went backwards to an older version.
What Changed
Before: v1.4.216 was built by Cut Release, but its draft had been created by a person first, so the release entry's author was that person. When its notes were edited, the policy deleted the release and its tag. It then picked a new "Latest" from releases authored only by
github-actions[bot], skipping v1.4.215 (published by a person), so Latest dropped to v1.4.214 and the stable auto-updater pointed back at it.After:
vX.Y.Zor an RC) is allowed when its tag was created by the release pipeline: an annotated tag whose tagger isgithub-actions[bot], pointing at the pipeline'srelease: vX.Y.Zcommit (scheduled RCs'[rc-slot:…]suffix included). Bot-authored releases are still allowed as before; mobile tags are unchanged.published. Aneditedevent never deletes a release or tag; it logs a warning instead.github-scriptmoved toconfig/scripts/release-policy.mjsso it can be unit tested. The workflow sparse-checks-out only that file from the same commit it runs from.Scope limit: GitHub runs a
releaseevent's workflow from the tagged commit, not from main (the run that deleted v1.4.216 ran on the tag commite4657e84). So this fix protects releases whose tag is cut after it lands; existing releases such as v1.4.215, and patch releases cut from branches that predate this change, still run the old policy when edited.Why
The tag and version commit are created only by Cut Release; the release entry's author is just whoever made the draft first (Cut Release reuses an existing draft rather than recreating it). Checking the tag keeps the original goal—stray hand-published releases still get removed when published—without deleting real releases.
Alternatives considered: dropping the
editedtrigger alone still leaves human-drafted CI releases deletable onpublishedand still regresses Latest; making Cut Release delete and recreate any pre-existing draft fixes new cuts but not v1.4.215 or future edits. A repository tag ruleset (noted as the proper fix in #13591) is still worth adding separately.Linked Issue
N/A. Follow-up to the v1.4.216 deletion on 2026-09-28 (Release Policy run 36466544163).
Visual Proof
N/A. CI workflow change, no UI.
Testing
config/scripts/release-policy.test.mjs: a human-drafted pipeline release survives an edit and becomes Latest; unauthorized releases are never deleted on edit; a hand-made tag, or a bot tag on a non-release commit, is still deleted on publish; scheduled RC commits pass; Latest ignores prereleases and compares versions numerically.Read-only dry run against the live repo using
gh api: v1.4.215, v1.4.214 and v1.4.21-rc.2 are recognized as pipeline-cut, and Latest would be set to v1.4.215 (release 397463952).Ran the workflow's exact
script:body inside anAsyncFunction, the waygithub-scriptruns it, against live data with every write stubbed: v1.4.215 (editedandpublished) and v1.4.214 (edited) make no deletes, and Latest stays v1.4.215.pr-workflow-parallelism.test.mjsstill passes (runner staysubuntu-slim).check:code-quality:changedpasses.I manually tested these changes locally
Automated tests added/updated, or explained why not below
Agent skill upstream boundary
docs/reference/agent-skill-sharing-upstream-boundary.mdand copies or mechanically translates no upstream skill-installer source, tests, fixtures, registry entries, path tables, comments, or documentation.Notes
Security: the workflow keeps
contents: writeonly. It already runs from the tagged commit (GitHub's behavior forreleaseevents), so loading the module from that same commit adds no new trust. A tag's tagger name can be set by anyone with push access, so this is a guard against accidents, not a security boundary, which is the same as the author check it replaces.Checklist
N/Awith reasonpnpm lint,pnpm typecheck,pnpm test, andpnpm buildpass (or CI will cover; local preferred)