Skip to content

Restore the tag object before checking that it is annotated - #37

Merged
wtgee merged 1 commit into
mainfrom
fix/release-annotated-tag-check
Sep 16, 2026
Merged

wtgee merged 1 commit into
mainfrom
fix/release-annotated-tag-check

Conversation

@wtgee

@wtgee wtgee commented Sep 16, 2026

Copy link
Copy Markdown
Member

The v0.5.0 release run failed with "v0.5.0 is a lightweight tag". The tag is not lightweight — the guard was reading a ref actions/checkout had replaced.

The tag is annotated

7125729b034ebe5e43f97133e53528168d996288	refs/tags/v0.5.0
48f226630f6e6c04a3d1ceda6b7d0f14a22da34f	refs/tags/v0.5.0^{}

A tag object dereferencing to 48f2266 — the same shape as v0.4.0. A lightweight tag has no ^{} line.

What the runner sees instead

For a tag push, actions/checkout fetches the commit SHA into the tag ref — +<sha>:refs/tags/<name> — so the checkout holds a lightweight tag whatever the remote carries. Reproduced against this repository:

$ git fetch --no-tags --depth=1 origin +48f226630f6e6c04a3d1ceda6b7d0f14a22da34f:refs/tags/v0.5.0
 * [new ref]  48f2266... -> v0.5.0

$ git cat-file -t v0.5.0
commit

$ git tag --list --format='%(contents)' v0.5.0
Cut 0.5.0 (#36)

Rolls the Unreleased section under a version heading. …

%(contents) returns the squash commit's subject. That is precisely the failure the guard was written for, so it was right to stop — it just attributed the cause to the tag rather than to the checkout.

The fix

Re-fetch the tag ref before the check. Verified on the same clone:

$ git fetch --force origin refs/tags/v0.5.0:refs/tags/v0.5.0
 t [tag update]  v0.5.0 -> v0.5.0

$ git cat-file -t v0.5.0
tag

$ git tag --list --format='%(contents)' v0.5.0
panoptes-data 0.5.0

This release moves the package onto the documents `panoptes-pipeline` writes …

The guard itself is unchanged. It is the only reason a commit subject did not ship as the 0.5.0 release notes, and it should keep failing a genuinely lightweight tag.

Retagging is required

A tag push runs the workflow from the tagged commit, so v0.5.0 still carries the old file and re-running its job will fail the same way. Once this is on main:

git push origin --delete v0.5.0
git tag -d v0.5.0
git fetch origin && git checkout main && git pull
git tag -a v0.5.0 -F <notes-file>          # the notes are unchanged
git push origin v0.5.0

Nothing was published, so deleting the tag costs nothing — the run failed at the first step, before the build and well before the PyPI upload. That ordering was deliberate.

🤖 Generated with Claude Code

https://claude.ai/code/session_01AnfKKSA7RyCwvsWhzyZ8zj


Generated by Claude Code

The annotated-tag guard failed v0.5.0, which is annotated on the remote:
`refs/tags/v0.5.0` is a tag object dereferencing to 48f2266, the same shape
as v0.4.0.

`actions/checkout` is what makes it look lightweight. For a tag push it
fetches the commit SHA *into* the tag ref -- `+<sha>:refs/tags/<name>` -- so
the runner's checkout holds a lightweight tag regardless of what the remote
carries. `git cat-file -t` then reports `commit` and the guard refuses.

Reproduced against this repository: fetching `+48f2266:refs/tags/v0.5.0`
yields `commit`, and `%(contents)` returns "Cut 0.5.0 (#36)" -- the squash
commit's subject. That is exactly the failure the guard exists to prevent, so
it was right to stop; it was reading a ref the checkout had replaced.

Re-fetching `refs/tags/<name>` restores the tag object. Verified on the same
clone: the type becomes `tag` and `%(contents)` returns the release notes.

The guard stays as it is. It is the only reason a commit subject did not ship
as the 0.5.0 release notes.

Note that a tag push runs the workflow from the tagged commit, so v0.5.0 has
to be retagged once this is on main.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01AnfKKSA7RyCwvsWhzyZ8zj
@wtgee
wtgee merged commit cd1b2bd into main Sep 16, 2026
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants