File tree Expand file tree Collapse file tree 1 file changed +21
-6
lines changed Expand file tree Collapse file tree 1 file changed +21
-6
lines changed Original file line number Diff line number Diff line change @@ -104,13 +104,28 @@ jobs:
104
104
id : release_notes
105
105
run : |
106
106
# Get the previous tag for comparison
107
- $previousTag = git describe --tags --abbrev=0 HEAD~1 2>$null
108
- if (-not $previousTag) {
109
- $previousTag = "HEAD~10" # Fallback if no previous tag
107
+ $previousTag = $null
108
+ try {
109
+ $previousTag = git describe --tags --abbrev=0 HEAD~1 2>$null
110
+ if ($LASTEXITCODE -ne 0) { $previousTag = $null }
111
+ } catch {
112
+ $previousTag = $null
110
113
}
111
114
112
- # Get commits since last release
113
- $commits = git log --pretty=format:"- %s" $previousTag..HEAD
115
+ # Get commits since last release or all commits if no previous tag
116
+ if ($previousTag) {
117
+ $commits = git log --pretty=format:"- %s" $previousTag..HEAD
118
+ $changelogUrl = "https://github.com/${{ github.repository }}/compare/$previousTag...${{ steps.version.outputs.version }}"
119
+ } else {
120
+ # First release - get recent commits
121
+ $commits = git log --pretty=format:"- %s" -10
122
+ $changelogUrl = "https://github.com/${{ github.repository }}/commits/${{ steps.version.outputs.version }}"
123
+ }
124
+
125
+ # Handle case where no commits are found
126
+ if (-not $commits) {
127
+ $commits = "- Initial release"
128
+ }
114
129
115
130
# Generate release notes
116
131
$releaseNotes = @"
@@ -142,7 +157,7 @@ jobs:
142
157
---
143
158
📦 **Download**: ``${{ env.PROJECT_NAME }}-${{ steps.version.outputs.version }}-win.zip``
144
159
145
- 📚 **Full Changelog**: https://github.com/${{ github.repository }}/compare/$previousTag...${{ steps.version.outputs.version }}
160
+ 📚 **Full Changelog**: $changelogUrl
146
161
"@
147
162
148
163
# Save release notes as multiline output
You can’t perform that action at this time.
0 commit comments