Repository navigation
ci(release): workflow_dispatch recovery trigger so a dropped tag-push run doesn't need a re-pushed tag - #229
Merged
Merged
Conversation
…-push run The 2026-08-06 Actions incident stopped push events from creating workflow runs. #228 added workflow_dispatch to ci.yml for the same reason; release.yml was left with no recovery at all — its only option is deleting and re-pushing a tag users already install from. The dispatch path cannot simply reuse the default checkout: actions/checkout resolves to the default branch on a dispatch, while goreleaser derives the version, changelog and artifact names from the git tag at HEAD. So the trigger takes a `tag` input and checks it out explicitly, and a guard asserts HEAD is exactly that tag before goreleaser runs. The tag-push path is untouched — the diff is 63 insertions and 0 deletions. `ref: ${{ github.event.inputs.tag }}` renders empty on a push, which actions/checkout treats identically to omitting the key, and the guard step is gated on github.event_name == 'workflow_dispatch'. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
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.
What
Adds
workflow_dispatchtorelease.ymlwith ataginput, so a dropped tag-push run can be re-run without deleting and re-pushing a published tag. Follow-up to #228, which did the same forci.yml.63 insertions, 0 deletions — every existing line is preserved verbatim.
Why
On 2026-08-06 an Actions incident throttled webhook delivery and push/pull_request events stopped creating workflow runs entirely. #228 covers the reasoning; the short version is that
workflow_dispatchis the only trigger that does not ride a webhook, and it cannot be back-applied (a dispatchable workflow must already exist on the default branch), so it only ever helps if it lands before the next incident. It will look permanently unused — the comment in the file says so, so nobody prunes it.release.ymlis the worse gap.ci.ymllosing a run costs a merge delay;release.ymllosing a run leaves deleting and re-pushing a tag users install from as the only recovery.Why this isn't a two-line change
actions/checkouton a tag push checks out the tag; onworkflow_dispatchit checks out the default branch. GoReleaser derives version, changelog and artifact names from the git tag at HEAD, never from anything the workflow hands it. A naiveworkflow_dispatchwould build frommain.So the trigger takes a
taginput, checks it out explicitly, and a guard asserts HEAD really is that tag before GoReleaser runs.Behaviour on each path
Tag push (unchanged).
ref: ${{ github.event.inputs.tag }}renders as the empty string, andactions/checkouttreats empty and absent identically —src/input-helper.ts:60-77dispatches on!result.ref, and the vendored@actions/coregetInputcollapses unset and empty to''.refhas nodefault:inaction.yml. The guard step is gated ongithub.event_name == 'workflow_dispatch'and is skipped.Dispatch. Checks out the named tag → detached HEAD at the tag's commit, identical end state to the push path (
ref-helper.ts:52-63→git checkout --progress --force refs/tags/<tag>, nostartPoint, so no-B). Then the guard runs, then GoReleaser as before.fetch-depth: 0is preserved and is load-bearing on both paths. Confirmed from source that it fetches all branches and all tags regardless ofref:git-source-provider.ts:172-186selectsgetRefSpecForAllHistory()whenfetchDepth <= 0, which returns['+refs/heads/*:refs/remotes/origin/*', '+refs/tags/*:refs/tags/*']and ignoresrefentirely (ref-helper.ts:6,69-77). The narrow per-ref refspec can only ever run as an additional follow-up fetch, and for a user-supplied tag name it is skipped outright. This matters because a clone missing earlier tags does not fail — GoReleaser logs a warning and publishes a truncated changelog.The guard
Three checks, each with its own error:
vprefix, a branch name likemain(a valid ref that checkout happily resolves), and a blank input — which is the nastiest case, because a blankrefmakes checkout fall back togithub.ref, i.e. the branch the dispatch was launched from. That one is silent at every other layer.Check 3 mirrors GoReleaser's own lookup rather than guessing at it.
internal/pipe/git/git.gogetTag()tries$GORELEASER_CURRENT_TAG(unset here), thengit tag --points-at HEAD --sort=-version:refname, and only falls back togit describe --tags --abbrev=0third. GoReleaser's ownvalidate()does not cover this: it runsgit describe --exact-match --tags --match <the tag it picked>, which asserts that some tag matching the name it chose is at HEAD — never that it matches the tag the operator requested. With two tags on one commit those differ.I originally wrote check 3 with
git describe --tags --abbrev=0and it was wrong. On a two-tags-on-one-commit repo,describe --abbrev=0returnsv0.2.0while GoReleaser resolvesv0.2.0-hotfix— so the original guard would have passed a request to releasev0.2.0and GoReleaser would have publishedv0.2.0-hotfix. Exactly the silent wrong-version publish the guard exists to prevent.Verified vs reasoned
I did not run the dispatch path — that would publish a release, which was explicitly out of scope. Split:
Mechanically verified
actionlint1.7.12 (+ shellcheck integration): 0 findings. Validated against positive controls rather than trusting the silence — a broken copy yieldslabel "ubunt-latest" is unknown, and, importantly,property "taggg" is not defined in object type {tag: string}, which proves actionlint parsed theworkflow_dispatchinputs schema and type-checked the expression against it. A separate control with an unquoted expansion in therun:block producedSC2086 ... [shellcheck]at that step's line, proving the guard script itself was linted and not skipped.YAML parses;
on:contains bothpush.tagsandworkflow_dispatch.inputs.tag.The guard script, extracted verbatim from the committed workflow, run against real repos. Every branch proven reachable and failing with its own message, not another check's:
v0.1.89(tag at HEAD)goreleaser will release v0.1.89v0.1.88(real tag, not HEAD)HEAD is cae9c2a… but tag v0.1.88 points at c0672f9…v9.9.99(nonexistent)'v9.9.99' is not a tagmain(branch name)'main' is not a tag""(blank input)'' is not a tagv0.2.0, two tags on the commitgoreleaser would release 'v0.2.0-hotfix', not 'v0.2.0'v0.2.0-hotfix, same commitGoReleaser and
actions/checkoutbehaviour above is quoted from source at pinned versions (goreleaser v2.17.1, checked for drift against v2.0.0/v2.8.2/v2.14.3 —git.gois effectively unchanged across v2; actions/checkout v4.2.2, diffed across all v4 tags — the fetch/ref logic is byte-identical on every v4).Reasoned, not executed
required: trueblocks an empty submission. It is enforced in the UI form, but the API can submit""; that is precisely why check 1 tests for it rather than relying on the input contract.Separate finding:
release-npm.ymlandGITHUB_TOKEN— the chain works, but not for the reason it looks likeThe concern was that
release.ymlcreates its release withsecrets.GITHUB_TOKEN, and GitHub deliberately does not trigger new workflow runs from events created withGITHUB_TOKEN— which would meanrelease-npm.ymlhas never fired automatically.It has. Of 53 historical
release-npm.ymlruns, 50 areevent: releaseand only 3 areworkflow_dispatch(two failed attempts on 2026-07-17 and the manual recovery after the v0.1.59 npm-sigstore failure). The automatic chain is real and is what publishes to npm.But the mechanism is not "GITHUB_TOKEN triggered it" —
.goreleaser.yamlsetsrelease: draft: true, so GoReleaser creates a draft, and a draft does not emitrelease: publishedat all. A human publishes it afterwards, and that is what fires the event.Evidence:
Every release is authored by
github-actions[bot](GoReleaser viaGITHUB_TOKEN), but everyrelease-event npm run hasactorandtriggering_actor=ZacxDev, a human — across all 50.The publish always happens after the
release.ymlrun has already completed, with a variable human-scale lag; the npm run then follows the publish by a near-constant ~2s webhook delay:The workflow had already exited before every one of these publishes, so nothing in it could have performed them. The 10s–95s spread is human, not automated.
So the loop-prevention rule is real and is one config flip away from biting. Nothing today depends on
GITHUB_TOKENtriggering anything — but ifrelease: draft: truewere ever flipped tofalseto "automate the last step", GoReleaser would publish the release directly withGITHUB_TOKEN, therelease: publishedevent would be suppressed, and npm publishing would silently stop while the GitHub release still looked perfect. Worth a comment in.goreleaser.yaml.Not fixed here, per instruction — it is a separate change with its own reasoning, and there is nothing broken to fix. Recorded so the next person does not assume the chain is fully automatic (there is a manual publish step) or assume the draft setting is incidental (it is load-bearing).
Note npm publishing uses OIDC trusted publishing pinned to repo + workflow file, with no
NPM_TOKEN. Nothing here changes that, and any future fix to the above should not reintroduce a long-lived token.Not determined
🤖 Generated with Claude Code