Skip to content

Commit 017c711

Browse files
committed
fix changelog generation
1 parent d6ce3a8 commit 017c711

1 file changed

Lines changed: 11 additions & 8 deletions

File tree

.github/workflows/Build-Release.yml

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -81,18 +81,21 @@ jobs:
8181
run: |
8282
$version = "${{ steps.ver.outputs.version }}"
8383
84-
# Find the previous standard (non-prerelease) release tag.
85-
$prevTag = ""
86-
$prevJson = gh release list --repo "$env:GITHUB_REPOSITORY" --exclude-drafts --exclude-prereleases --json tagName --limit 1
84+
# Find when the previous standard (non-prerelease) release was published.
85+
# Range by the release DATE (not the tag): old release tags here are
86+
# orphaned (not ancestors of HEAD) after a history rewrite, so a
87+
# <tag>..HEAD range would return the entire history.
88+
$since = ""
89+
$prevJson = gh release list --repo "$env:GITHUB_REPOSITORY" --exclude-drafts --exclude-prereleases --json publishedAt --limit 1
8790
if ($prevJson) {
8891
$parsed = $prevJson | ConvertFrom-Json
89-
if ($parsed) { $prevTag = $parsed[0].tagName }
92+
if ($parsed) { $since = $parsed[0].publishedAt }
9093
}
91-
Write-Host "Previous standard release tag: '$prevTag'"
94+
Write-Host "Previous standard release publishedAt: '$since'"
9295
93-
# Gather commit subjects since that tag (or from full history on the first release).
94-
if ($prevTag -and (git rev-parse --verify --quiet "refs/tags/$prevTag")) {
95-
$commits = git log "$prevTag..HEAD" --no-merges --pretty=format:"- %s"
96+
# Commits after the previous release (or full history on the first release).
97+
if ($since) {
98+
$commits = git log --since="$since" --no-merges --pretty=format:"- %s"
9699
} else {
97100
Write-Host "No previous standard release found; using full history."
98101
$commits = git log --no-merges --max-count=200 --pretty=format:"- %s"

0 commit comments

Comments
 (0)