Skip to content

Commit

Permalink
ci(workflow): improve changelog generation in release workflow
Browse files Browse the repository at this point in the history
- Add null check for LATEST_RELEASE to handle cases where no previous release exists
- Modify git log command to use '--' for better handling of commit messages with special characters
- Add debug echo for LATEST_RELEASE value
  • Loading branch information
godcong committed Nov 28, 2024
1 parent 8459637 commit b80d71c
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions .github/workflows/release_and_tagging.yml
Original file line number Diff line number Diff line change
Expand Up @@ -60,16 +60,17 @@ jobs:
id: generate_changelog
run: |
LATEST_RELEASE=${{ steps.get_latest_release.outputs.LATEST_RELEASE }}
echo "LATEST_RELEASE is $LATEST_RELEASE"
echo "# Changelog" > changelog.txt
if [[ -z "$LATEST_RELEASE" ]]; then
# If there's no previous release, get only the current commit's log
if [[ -z "$LATEST_RELEASE" || "$LATEST_RELEASE" == "null" ]]; then
# If there's no previous release, get only the current commit log
git config --global core.pager cat
# git log --pretty=format:"* %s **by** @%an"
git log --pretty=format:"* %s **by** @%an" >> changelog.txt
else
# Get all submission information since the last release
CHANGELOG=$(git log "$LATEST_RELEASE"..HEAD --pretty=format:"* %s **by** @%an")
git log "$LATEST_RELEASE"..HEAD --pretty=format:"* %s **by** @%an" >> changelog.txt
CHANGELOG=$(git log "$LATEST_RELEASE"..HEAD -- --pretty=format:"* %s **by** @%an")
git log "$LATEST_RELEASE"..HEAD -- --pretty=format:"* %s **by** @%an" >> changelog.txt
fi
- name: Create release
Expand Down

0 comments on commit b80d71c

Please sign in to comment.