Mirrowel commited on
Commit
477f402
Β·
1 Parent(s): da32588

feat: improve changelog generation by handling tag ranges and repository URL

Browse files
Files changed (1) hide show
  1. .github/workflows/build.yml +8 -19
.github/workflows/build.yml CHANGED
@@ -101,27 +101,16 @@ jobs:
101
  id: changelog
102
  shell: bash
103
  run: |
104
- echo "πŸ” Generating changelog for build-${{ steps.version.outputs.version }}"
105
-
106
- # Find the last build tag
107
  LAST_TAG=$(git describe --tags --abbrev=0 --match="build-*" 2>/dev/null || echo "")
108
- CURRENT_TAG="build-${{ steps.version.outputs.version }}"
109
-
110
- echo "Last tag: ${LAST_TAG:-'None found'}"
111
- echo "Current tag: $CURRENT_TAG"
112
-
113
- # Set environment for git-cliff
114
- export GIT_CLIFF_TAG="$CURRENT_TAG"
115
 
116
- if [ -n "$LAST_TAG" ]; then
117
- echo "πŸ“Š Generating changelog from $LAST_TAG to HEAD"
118
- # Generate changelog for specific range
119
- git-cliff --config cliff.toml --strip all --output changelog.md "$LAST_TAG..HEAD"
120
- else
121
- echo "πŸ“Š No previous build tag found, showing recent commits"
122
- # First release - show last 10 commits
123
- git-cliff --config cliff.toml --strip all --output changelog.md --unreleased
124
- fi
125
 
126
  # Check if changelog was generated successfully
127
  if [ -f "changelog.md" ] && [ -s "changelog.md" ]; then
 
101
  id: changelog
102
  shell: bash
103
  run: |
 
 
 
104
  LAST_TAG=$(git describe --tags --abbrev=0 --match="build-*" 2>/dev/null || echo "")
105
+ RANGE="${LAST_TAG:+$LAST_TAG..HEAD}"
106
+ echo "πŸ” Generating changelog for build-${{ steps.version.outputs.version }} ($RANGE)"
 
 
 
 
 
107
 
108
+ git-cliff \
109
+ --config cliff.toml \
110
+ --strip all \
111
+ --repository-url "https://github.com/${{ github.repository }}" \
112
+ --output changelog.md \
113
+ ${RANGE:---unreleased}
 
 
 
114
 
115
  # Check if changelog was generated successfully
116
  if [ -f "changelog.md" ] && [ -s "changelog.md" ]; then