File tree Expand file tree Collapse file tree 1 file changed +27
-5
lines changed Expand file tree Collapse file tree 1 file changed +27
-5
lines changed Original file line number Diff line number Diff line change @@ -185,15 +185,37 @@ jobs:
185
185
steps :
186
186
- name : Checkout repository
187
187
uses : actions/checkout@v4
188
+ with :
189
+ fetch-depth : 0 # Ensures full history is available
188
190
189
191
- name : Generate Changelog
190
192
id : changelog
191
193
run : |
192
- git fetch --prune --unshallow 2> /dev/null || true
193
- echo "## Changelog" > changelog.txt
194
- echo "" >> changelog.txt
195
- git log --pretty=format:"- %s (%h) by %an" $(git rev-parse HEAD^)..HEAD >> changelog.txt
196
- echo "CHANGELOG=$(cat changelog.txt)" >> $GITHUB_OUTPUT
194
+ echo "Generating changelog..."
195
+
196
+ # Ensure full history is available
197
+ git fetch --prune --unshallow || true
198
+
199
+ # Generate changelog from the last 10 commits
200
+ CHANGELOG=$(git log --pretty=format:"- %s (%h) by %an" -n 10 | sed 's/"/\\"/g' | tr -d '\r')
201
+
202
+ # Output the changelog for debugging
203
+ echo "Changelog:"
204
+ echo "$CHANGELOG"
205
+
206
+ # Store changelog in environment variable safely
207
+ {
208
+ echo 'CHANGELOG<<EOF'
209
+ echo "$CHANGELOG"
210
+ echo 'EOF'
211
+ } >> "$GITHUB_ENV"
212
+
213
+ # Store changelog in GITHUB_OUTPUT so it can be used in later steps
214
+ {
215
+ echo 'CHANGELOG<<EOF'
216
+ echo "$CHANGELOG"
217
+ echo 'EOF'
218
+ } >> "$GITHUB_OUTPUT"
197
219
198
220
- name : Upload Changelog as artifact
199
221
uses : actions/upload-artifact@v4
You can’t perform that action at this time.
0 commit comments