Skip to content

Commit edf9fa7

Browse files
jlia0claude
andcommitted
fix(ci): debug and re-fetch tag object for release notes extraction
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent 2752e94 commit edf9fa7

1 file changed

Lines changed: 25 additions & 6 deletions

File tree

‎.github/workflows/release.yml‎

Lines changed: 25 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -118,22 +118,41 @@ jobs:
118118
id: release_notes
119119
run: |
120120
VERSION="${{ steps.get_version.outputs.version }}"
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)
121+
122+
# Debug: show what git sees for this tag
123+
echo "=== Tag ref debug ==="
124+
git rev-parse "refs/tags/$VERSION" 2>/dev/null || echo "rev-parse failed"
125+
git cat-file -t "refs/tags/$VERSION" 2>/dev/null || echo "cat-file -t failed"
126+
git for-each-ref --format='%(objecttype)' "refs/tags/$VERSION" || echo "for-each-ref failed"
127+
128+
# Try to get the annotated tag message via cat-file
129+
TAG_TYPE=$(git cat-file -t "refs/tags/$VERSION" 2>/dev/null)
130+
echo "Tag type: $TAG_TYPE"
131+
125132
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
133+
git cat-file -p "refs/tags/$VERSION" | sed '1,/^$/d' > release_notes.md
134+
elif [ "$TAG_TYPE" = "commit" ]; then
135+
# Lightweight tag or dereferenced — try fetching the actual tag object
136+
git fetch origin "refs/tags/$VERSION:refs/tags/$VERSION" --force 2>/dev/null
137+
TAG_TYPE2=$(git cat-file -t "refs/tags/$VERSION" 2>/dev/null)
138+
echo "Tag type after re-fetch: $TAG_TYPE2"
139+
if [ "$TAG_TYPE2" = "tag" ]; then
140+
git cat-file -p "refs/tags/$VERSION" | sed '1,/^$/d' > release_notes.md
141+
fi
128142
fi
143+
129144
if [ ! -s release_notes.md ]; then
145+
echo "::warning::Could not extract annotated tag message, using fallback"
130146
cat > release_notes.md <<EOF
131147
## TinyClaw $VERSION
132148
133149
See commits since last release for detailed changes.
134150
EOF
135151
fi
136152
153+
echo "=== release_notes.md preview ==="
154+
head -5 release_notes.md
155+
137156
- name: Create GitHub Release
138157
uses: softprops/action-gh-release@v1
139158
if: github.ref_type == 'tag'

0 commit comments

Comments
 (0)