From 1417d35cd7ee4a94a9319846c843ee3d7e4e3d9c Mon Sep 17 00:00:00 2001 From: PandaDEV <70103896+0PandaDEV@users.noreply.github.com> Date: Wed, 25 Dec 2024 21:31:26 +1000 Subject: [PATCH] fix(release): enhance changelog generation to handle missing tags --- .github/workflows/release.yml | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 5b6ecf8..f79b85d 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -243,12 +243,18 @@ jobs: id: release_body run: | VERSION="${{ needs.prepare.outputs.version }}" - echo "Debug: Listing tags" - git tag -l - echo "Debug: Getting latest tag" - git describe --tags --abbrev=0 || echo "No tags found" - echo "Debug: Generating changelog" - CHANGES=$(git log "$(git describe --tags --abbrev=0 2>/dev/null || echo HEAD^)" HEAD --pretty=format:"- %s" || echo "No changelog available") + + # Get the most recent release tag (v* tags only) + LAST_TAG=$(git describe --match "v*" --abbrev=0 --tags `git rev-list --tags --skip=1 --max-count=1` 2>/dev/null || echo "") + + if [ -n "$LAST_TAG" ]; then + echo "Debug: Found last release tag: $LAST_TAG" + CHANGES=$(git log ${LAST_TAG}..HEAD --pretty=format:"- %s") + else + echo "Debug: No previous release tag found, using first commit" + CHANGES=$(git log --pretty=format:"- %s") + fi + echo "Debug: Changelog content:" echo "$CHANGES"