-
Notifications
You must be signed in to change notification settings - Fork 0
/
action.yml
339 lines (298 loc) · 10.3 KB
/
action.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
name: Generate and Upload Changelog
description: Generates a changelog using auto-changelog, with options to upload to GitHub Releases and as an artifact
branding:
icon: 'file-text'
color: 'red'
inputs:
output:
required: false
default: "CHANGELOG.md"
description: "Output file path"
config:
required: false
default: ""
description: "Path to the auto-changelog config file"
template:
required: false
default: "compact"
description: "Specify template to use [compact, keepachangelog, json]"
remote:
required: false
default: ""
description: "Specify git remote to use for links"
package:
required: false
default: ""
description: "Use version from file as latest release"
latest-version:
required: false
default: ""
description: "Use specified version as latest release"
unreleased:
required: false
default: "false"
description: "Include section for unreleased changes"
commit-limit:
required: false
default: ""
description: "Number of commits to display per release"
backfill-limit:
required: false
default: ""
description: "Number of commits to backfill empty releases with"
commit-url:
required: false
default: ""
description: "Override URL for commits, use {id} for commit id"
issue-url:
required: false
default: ""
description: "Override URL for issues, use {id} for issue id"
merge-url:
required: false
default: ""
description: "Override URL for merges, use {id} for merge id"
compare-url:
required: false
default: ""
description: "Override URL for compares, use {from} and {to} for tags"
issue-pattern:
required: false
default: ""
description: "Override regex pattern for issues in commit messages"
breaking-pattern:
required: false
default: ""
description: "Regex pattern for breaking change commits"
merge-pattern:
required: false
default: ""
description: "Add custom regex pattern for merge commits"
commit-pattern:
required: false
default: ""
description: "Pattern to include when parsing commits"
ignore-commit-pattern:
required: false
default: ""
description: "Pattern to ignore when parsing commits"
tag-pattern:
required: false
default: ""
description: "Override regex pattern for version tags"
tag-prefix:
required: false
default: ""
description: "Prefix used in version tags"
starting-version:
required: false
default: ""
description: "Specify earliest version to include in changelog"
starting-date:
required: false
default: ""
description: "Specify earliest date to include in changelog"
ending-version:
required: false
default: ""
description: "Specify latest version to include in changelog"
sort-commits:
required: false
default: "relevance"
description: "Sort commits by property [relevance, date, date-desc, subject, subject-desc]"
release-summary:
required: false
default: "false"
description: "Display tagged commit message body as release summary"
unreleased-only:
required: false
default: "false"
description: "Only output unreleased changes"
hide-empty-releases:
required: false
default: "false"
description: "Hide empty releases"
hide-credit:
required: false
default: "false"
description: "Hide auto-changelog credit"
handlebars-setup:
required: false
default: ""
description: "Handlebars setup file"
append-git-log:
required: false
default: ""
description: "String to append to git log command"
append-git-tag:
required: false
default: ""
description: "String to append to git tag command"
prepend:
required: false
default: "false"
description: "Prepend changelog to output file"
stdout:
required: false
default: "false"
description: "Output changelog to stdout"
upload-artifact:
required: false
default: "false"
description: "Upload the generated changelog as an artifact"
upload-release:
required: false
default: "false"
description: "Upload the generated changelog to GitHub Releases"
is-release:
required: false
default: "false"
description: "Whether this is a GitHub Release"
release-tag:
required: false
default: ""
description: "Tag associated with the GitHub Release"
override-starting-version:
required: false
default: "false"
description: "Override the starting version with the release tag if this is a GitHub Release"
artifact-name:
required: false
default: "Changelog"
description: "Override the artifact name for the changelog"
auto-checkout:
required: false
default: 'true'
description: "Automatically checks out the current repository"
runs:
using: "composite"
steps:
- name: Checkout code
uses: actions/checkout@v4
if: ${{ inputs.auto-checkout == 'true' }}
with:
fetch-depth: 0
- name: Install auto-changelog
run: npm install -g auto-changelog
shell: bash
- name: Set Starting Version
id: set-starting-version
run: |
if [[ "${{ inputs.is-release }}" == "true" && "${{ inputs.override-starting-version }}" == "true" ]]; then
echo "starting_version=${{ inputs.release-tag }}" >> $GITHUB_OUTPUT
else
echo "starting_version=${{ inputs.starting-version }}" >> $GITHUB_OUTPUT
fi
shell: bash
- name: Generate Changelog
run: |
command="auto-changelog"
command+=" --output \"${{ inputs.output }}\""
if [[ "${{ inputs.config }}" != "" ]]; then
command+=" --config \"${{ inputs.config }}\""
fi
command+=" --template \"${{ inputs.template }}\""
if [[ "${{ inputs.remote }}" != "" ]]; then
command+=" --remote \"${{ inputs.remote }}\""
fi
if [[ "${{ inputs.package }}" != "" ]]; then
command+=" --package \"${{ inputs.package }}\""
fi
if [[ "${{ inputs.latest-version }}" != "" ]]; then
command+=" --latest-version \"${{ inputs.latest-version }}\""
fi
if [[ "${{ inputs.unreleased }}" == "true" ]]; then
command+=" --unreleased"
fi
if [[ "${{ inputs.commit-limit }}" != "" ]]; then
command+=" --commit-limit \"${{ inputs.commit-limit }}\""
fi
if [[ "${{ inputs.backfill-limit }}" != "" ]]; then
command+=" --backfill-limit \"${{ inputs.backfill-limit }}\""
fi
if [[ "${{ inputs.commit-url }}" != "" ]]; then
command+=" --commit-url \"${{ inputs.commit-url }}\""
fi
if [[ "${{ inputs.issue-url }}" != "" ]]; then
command+=" --issue-url \"${{ inputs.issue-url }}\""
fi
if [[ "${{ inputs.merge-url }}" != "" ]]; then
command+=" --merge-url \"${{ inputs.merge-url }}\""
fi
if [[ "${{ inputs.compare-url }}" != "" ]]; then
command+=" --compare-url \"${{ inputs.compare-url }}\""
fi
if [[ "${{ inputs.issue-pattern }}" != "" ]]; then
command+=" --issue-pattern \"${{ inputs.issue-pattern }}\""
fi
if [[ "${{ inputs.breaking-pattern }}" != "" ]]; then
command+=" --breaking-pattern \"${{ inputs.breaking-pattern }}\""
fi
if [[ "${{ inputs.merge-pattern }}" != "" ]]; then
command+=" --merge-pattern \"${{ inputs.merge-pattern }}\""
fi
if [[ "${{ inputs.commit-pattern }}" != "" ]]; then
command+=" --commit-pattern \"${{ inputs.commit-pattern }}\""
fi
if [[ "${{ inputs.ignore-commit-pattern }}" != "" ]]; then
command+=" --ignore-commit-pattern \"${{ inputs.ignore-commit-pattern }}\""
fi
if [[ "${{ inputs.tag-pattern }}" != "" ]]; then
command+=" --tag-pattern \"${{ inputs.tag-pattern }}\""
fi
if [[ "${{ inputs.tag-prefix }}" != "" ]]; then
command+=" --tag-prefix \"${{ inputs.tag-prefix }}\""
fi
if [[ "${{ steps.set-starting-version.outputs.starting_version }}" != "" ]]; then
command+=" --starting-version \"${{ steps.set-starting-version.outputs.starting_version }}\""
fi
if [[ "${{ inputs.starting-date }}" != "" ]]; then
command+=" --starting-date \"${{ inputs.starting-date }}\""
fi
if [[ "${{ inputs.ending-version }}" != "" ]]; then
command+=" --ending-version \"${{ inputs.ending-version }}\""
fi
command+=" --sort-commits \"${{ inputs.sort-commits }}\""
if [[ "${{ inputs.release-summary }}" == "true" ]]; then
command+=" --release-summary"
fi
if [[ "${{ inputs.unreleased-only }}" == "true" ]]; then
command+=" --unreleased-only"
fi
if [[ "${{ inputs.hide-empty-releases }}" == "true" ]]; then
command+=" --hide-empty-releases"
fi
if [[ "${{ inputs.hide-credit }}" == "true" ]]; then
command+=" --hide-credit"
fi
if [[ "${{ inputs.handlebars-setup }}" != "" ]]; then
command+=" --handlebars-setup \"${{ inputs.handlebars-setup }}\""
fi
if [[ "${{ inputs.append-git-log }}" != "" ]]; then
command+=" --append-git-log \"${{ inputs.append-git-log }}\""
fi
if [[ "${{ inputs.append-git-tag }}" != "" ]]; then
command+=" --append-git-tag \"${{ inputs.append-git-tag }}\""
fi
if [[ "${{ inputs.prepend }}" == "true" ]]; then
command+=" --prepend"
fi
if [[ "${{ inputs.stdout }}" == "true" ]]; then
command+=" --stdout"
fi
echo "$command"
eval "$command"
shell: bash
- name: Upload Changelog Artifact
uses: actions/upload-artifact@v4
if: ${{ inputs.upload-artifact == 'true' }}
with:
name: ${{ inputs.artifact-name }}
path: ${{ inputs.output }}
- name: Upload Changelog to GitHub Release
uses: softprops/[email protected]
if: ${{ inputs.upload-release == 'true' }}
with:
body_path: ${{ inputs.output }}
files: |
${{ inputs.output }}