Skip to content

Commit 2752e94

Browse files
jlia0claude
andcommitted
fix(ci): use git cat-file for reliable tag message extraction
%(contents) format dereferences annotated tags to commit messages in CI. Use git cat-file -p to read the raw tag object directly. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent 49ac61c commit 2752e94

1 file changed

Lines changed: 9 additions & 6 deletions

File tree

‎.github/workflows/release.yml‎

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -118,12 +118,15 @@ jobs:
118118
id: release_notes
119119
run: |
120120
VERSION="${{ steps.get_version.outputs.version }}"
121-
# git tag -l --format reads the annotated tag object directly,
122-
# unlike for-each-ref which can dereference to the commit in CI
123-
TAG_MESSAGE=$(git tag -l --format='%(contents)' "$VERSION")
124-
if [ -n "$TAG_MESSAGE" ]; then
125-
printf '%s\n' "$TAG_MESSAGE" > release_notes.md
126-
else
121+
# Use git cat-file to read the raw annotated tag object directly,
122+
# bypassing %(contents) which can dereference to the commit message
123+
TAG_OBJ=$(git rev-parse "refs/tags/$VERSION" 2>/dev/null)
124+
TAG_TYPE=$(git cat-file -t "$TAG_OBJ" 2>/dev/null)
125+
if [ "$TAG_TYPE" = "tag" ]; then
126+
# Annotated tag: extract message body (everything after the blank line)
127+
git cat-file -p "$TAG_OBJ" | sed '1,/^$/d' > release_notes.md
128+
fi
129+
if [ ! -s release_notes.md ]; then
127130
cat > release_notes.md <<EOF
128131
## TinyClaw $VERSION
129132

0 commit comments

Comments
 (0)