Skip to content

Commit 1417d35

Browse files
committed
fix(release): enhance changelog generation to handle missing tags
1 parent dc34912 commit 1417d35

File tree

1 file changed

+12
-6
lines changed

1 file changed

+12
-6
lines changed

.github/workflows/release.yml

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -243,12 +243,18 @@ jobs:
243243
id: release_body
244244
run: |
245245
VERSION="${{ needs.prepare.outputs.version }}"
246-
echo "Debug: Listing tags"
247-
git tag -l
248-
echo "Debug: Getting latest tag"
249-
git describe --tags --abbrev=0 || echo "No tags found"
250-
echo "Debug: Generating changelog"
251-
CHANGES=$(git log "$(git describe --tags --abbrev=0 2>/dev/null || echo HEAD^)" HEAD --pretty=format:"- %s" || echo "No changelog available")
246+
247+
# Get the most recent release tag (v* tags only)
248+
LAST_TAG=$(git describe --match "v*" --abbrev=0 --tags `git rev-list --tags --skip=1 --max-count=1` 2>/dev/null || echo "")
249+
250+
if [ -n "$LAST_TAG" ]; then
251+
echo "Debug: Found last release tag: $LAST_TAG"
252+
CHANGES=$(git log ${LAST_TAG}..HEAD --pretty=format:"- %s")
253+
else
254+
echo "Debug: No previous release tag found, using first commit"
255+
CHANGES=$(git log --pretty=format:"- %s")
256+
fi
257+
252258
echo "Debug: Changelog content:"
253259
echo "$CHANGES"
254260

0 commit comments

Comments
 (0)