Skip to content

Commit 16dcebf

Browse files
committed
fix(changelog): improve changelog generation logic
- Update the logic to fetch the previous tag for changelog generation. - Ensure that the changelog captures commits since the last version tag or the last 20 commits if no previous tag exists.
1 parent 1bd5c43 commit 16dcebf

File tree

1 file changed

+4
-5
lines changed

1 file changed

+4
-5
lines changed

.github/workflows/build_app.yml

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -262,12 +262,11 @@ jobs:
262262
- name: Generate changelog
263263
id: changelog
264264
run: |
265-
$currentTag = "v${{ steps.version.outputs.VERSION }}"
266-
$prevTag = (git tag --sort=-version:refname | Where-Object { $_ -ne $currentTag } | Select-Object -First 1)
267-
if ([string]::IsNullOrWhiteSpace($prevTag)) {
268-
$commits = git log -n 20 --pretty=format:"* %s %h" --no-merges
265+
$prevTag = git tag -l --sort=-version:refname | Where-Object { $_ -match '^v\d+\.\d+\.\d+$' } | Select-Object -First 1
266+
if (-not [string]::IsNullOrWhiteSpace($prevTag)) {
267+
$commits = git log "$prevTag..HEAD" --pretty=format:"* %s %h" --no-merges
269268
} else {
270-
$commits = git log "$prevTag..$currentTag" --pretty=format:"* %s %h" --no-merges
269+
$commits = git log -n 20 --pretty=format:"* %s %h" --no-merges
271270
}
272271
if ([string]::IsNullOrWhiteSpace($commits)) { $commits = "* No significant changes" }
273272
$commits | Out-File -FilePath CHANGELOG.md -Encoding utf8

0 commit comments

Comments
 (0)