fix(release): detect resume by tag, not by HEAD commit message#2423
Merged
Conversation
The previous logic only recognised a resume when main HEAD itself was the `chore: prepare release X [skip ci]` commit. If a follow-up commit landed on top (a hotfix to the release workflow itself, in v1.12.3's case), HEAD was no longer the release commit and the tag-exists guard fired, refusing to resume — even though the rest of the work was already done and the commit was still in main's history. Switch to tag-based detection: if v<version> exists on origin, this is a resume; pull the release commit SHA from the tag's object (deref the annotated tag). The tag is the actual artifact we're trying to land, so it's the right resume signal regardless of where main HEAD has moved. A bare caddy/v<version> without v<version> still aborts as a split- state guard.
Contributor
There was a problem hiding this comment.
Pull request overview
This PR adjusts the GitHub Actions release workflow’s “resume” detection to key off the existence of the v<version> tag (and resolve the commit SHA from the tag object), instead of relying on main’s HEAD commit message—allowing a release to be resumed even if follow-up commits landed on top of the release commit.
Changes:
- Switch resume detection from
mainHEAD commit-message matching tov<version>tag existence. - Resolve the release commit SHA via dereferencing annotated tags (
git/tags/<sha> -> object.sha). - Replace the previous “tags exist but HEAD mismatch” guard with a “split state” guard (
caddy/v<version>exists withoutv<version>).
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Per Copilot review: resume-by-tag-existence proceeds even when the tag's target isn't reachable from main (orphan tag created on a side branch). Add a `git merge-base --is-ancestor` check so we abort rather than skip the bump/commit steps against unreachable history.
Per Copilot review (flagged twice): `if ref=$(gh api ...); then` swallowed transient API failures (rate limit, 5xx, auth) as "tag missing", silently downgrading a resume into a fresh attempt with no visible state divergence. Capture stderr, branch on whether it contains `(HTTP 404)`: only that case is a true "tag absent → fresh attempt". Anything else aborts with the original stderr surfaced.
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.
Summary
The resume detection in
release.yamlonly recognised a resume whenmainHEAD itself was thechore: prepare release X [skip ci]commit. If a follow-up commit landed on top — exactly what happened mid-1.12.3 release when #2421 and #2422 had to merge after the tag was created — HEAD was no longer the release commit and the workflow's tag-existence guard fired, refusing to resume even though tags + commit were already in main's history.Fix
Use tag existence as the resume signal instead. The tag
v<version>is the actual artifact we're trying to land; whether main HEAD has advanced past it doesn't matter for the resume decision. The release commit SHA is read from the tag's object (with annotated-tag dereferencing).A bare
caddy/v<version>tag withoutv<version>still aborts as a split-state guard.Validation
This is the third workflow patch needed during the v1.12.3 dispatch (#2421 ARG_MAX, #2422 REST draft). With this in place, re-dispatching v1.12.3 should detect
resume=true, skip PGO/bump/commit/tag (all already done), reach the now-fixed Draft step, create the draft via REST, dispatch downstreams, bump Homebrew. Run time ~30s.