fix(ci): fetch-tags on tag-introspection checkouts so signed annotated tags pass#532
Open
branarakic wants to merge 1 commit into
Open
fix(ci): fetch-tags on tag-introspection checkouts so signed annotated tags pass#532branarakic wants to merge 1 commit into
branarakic wants to merge 1 commit into
Conversation
…d tags pass
The `Validate release candidate` job in `release.yml` and the `Require
signed annotated tag` job in `npm-publish.yml` both use `actions/checkout`
to materialise the pushed tag, then run `git cat-file -t <tag>` to verify
the tag is annotated (and `git cat-file -p <tag>` to grep for a PGP/SSH
signature block).
`actions/checkout@v4` does not fetch annotated tag OBJECTS by default —
it materialises the tag as a synthetic lightweight ref pointing at the
commit. So `git cat-file -t <tag>` returns `commit` instead of `tag`,
and the structural signed-tag gate rejects legitimately signed tags
with "Tag is a lightweight ref ... lightweight tags cannot carry a
signature".
This was the failure mode on `v10.0.0-rc.8`: the tag was correctly
created with `git tag -s` (annotated, SSH-signed) and `git ls-remote`
on the remote shows it as a tag object whose `^{}` peels to the merge
commit. But the workflow's runner saw it as lightweight because
`fetch-tags: true` was missing from the checkout.
Setting `fetch-tags: true` makes actions/checkout actually download the
annotated tag object alongside the commit, so `git cat-file -t` returns
the expected `tag` and the signature-block grep can read the body.
Author intent (from the existing comments in release.yml around line 100)
is unambiguous: the structural check is meant to PASS for annotated
signed tags and only REJECT lightweight or unsigned tags. This fix
restores that intended behaviour.
Co-authored-by: Cursor <cursoragent@cursor.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.
Summary
The release.yml
Validate release candidatejob and the npm-publish.ymlRequire signed annotated tagjob both rely ongit cat-file -t <tag>returningtagfor annotated tags. They useactions/checkout@v4to materialise the tag, but withoutfetch-tags: true— which means the runner gets a synthetic lightweight ref pointing at the commit, not the tag-object.So
git cat-file -t v10.0.0-rc.8returnscommitinstead oftag, and the structural signed-tag gate rejects the (correctly signed) tag with:This was the failure mode on the
v10.0.0-rc.8push earlier today (release.yml run 25943282274). The tag was correctly created withgit tag -s—git ls-remoteshows it as a tag object whose^{}peels to the merge commit onmain, and the body contains the expected-----BEGIN SSH SIGNATURE-----block.Author intent is unambiguous
From
release.ymllines 100–124:The gate is supposed to PASS legitimately-signed annotated tags. The bug is purely the missing
fetch-tags: true.Change
14 lines, in two places:
release.ymlValidate release candidatecheckout (line 53–60)npm-publish.ymlRequire signed annotated tagcheckout (line 226–230)Both gain
fetch-tags: trueplus a 6-line comment explaining why the option matters.No version bump (workflow-only change). No test changes (these are CI gates that fire only on tag pushes).
Other checkouts in these workflows
Audited:
release.ymlline 281 (Build MarkItDown binary): doesn't read tag annotation, no change needed.release.ymlline 428 (Build, test, and create release): uses--notes-file release_notes.md(sourced fromCHANGELOG.md), not the tag annotation; doesn't needfetch-tags.npm-publish.ymlline 284 (build-and-pack): only reads.nvmrcandpackage.json; doesn't needfetch-tags.So the minimal correct fix is exactly these two checkouts.
Test plan
.github/workflows/)package.jsonversions touchedactions/checkoutin both workflows for the same bugv10.0.0-rc.8(local + remote), re-tag against newmainHEAD, push → release.yml passes structural gate → reviewer approvesnpm-publishEnvironment → publish completesWhy this didn't fire before
v10.0.0-rc.7and earlier went through the OLD continuous-publish-on-merge flow. PR #522 introduced the new tag-triggered flow with this signed-tag gate, andv10.0.0-rc.8is the first tag pushed under it — first time the bug was exercised.Made with Cursor