+78
-24
release-notes-assistant.sh
+78
-24
release-notes-assistant.sh
···
7
7
label_feature=feature
8
8
label_ui=forgejo/ui
9
9
label_breaking=breaking
10
+
label_security=security
10
11
label_localization=forgejo/i18n
11
12
12
13
payload=$(mktemp)
···
17
18
set -ex
18
19
PS4='${BASH_SOURCE[0]}:$LINENO: ${FUNCNAME[0]}: '
19
20
21
+
test_payload_labels $label_worth $label_breaking $label_security $label_bug
22
+
test "$(categorize)" = 'AA Breaking security bug fixes'
23
+
24
+
test_payload_labels $label_worth $label_security $label_bug
25
+
test "$(categorize)" = 'AB Security bug fixes'
26
+
27
+
test_payload_labels $label_worth $label_breaking $label_security $label_feature
28
+
test "$(categorize)" = 'AC Breaking security features'
29
+
30
+
test_payload_labels $label_worth $label_security $label_feature
31
+
test "$(categorize)" = 'AD Security features'
32
+
33
+
test_payload_labels $label_worth $label_security
34
+
test "$(categorize)" = 'ZA Security changes without a feature or bug label'
35
+
20
36
test_payload_labels $label_worth $label_breaking $label_feature
21
-
test "$(categorize)" = 'AA Breaking features'
37
+
test "$(categorize)" = 'BA Breaking features'
22
38
23
39
test_payload_labels $label_worth $label_breaking $label_bug
24
-
test "$(categorize)" = 'AB Breaking bug fixes'
40
+
test "$(categorize)" = 'BB Breaking bug fixes'
25
41
26
42
test_payload_labels $label_worth $label_breaking
27
-
test "$(categorize)" = 'ZC Breaking changes without a feature or bug label'
43
+
test "$(categorize)" = 'ZB Breaking changes without a feature or bug label'
28
44
29
45
test_payload_labels $label_worth $label_ui $label_feature
30
-
test "$(categorize)" = 'BA User Interface features'
46
+
test "$(categorize)" = 'CA User Interface features'
31
47
32
48
test_payload_labels $label_worth $label_ui $label_bug
33
-
test "$(categorize)" = 'BB User Interface bug fixes'
49
+
test "$(categorize)" = 'CB User Interface bug fixes'
34
50
35
51
test_payload_labels $label_worth $label_ui
36
-
test "$(categorize)" = 'ZD User Interface changes without a feature or bug label'
52
+
test "$(categorize)" = 'ZC User Interface changes without a feature or bug label'
53
+
54
+
test_payload_labels $label_worth $label_localization
55
+
test "$(categorize)" = 'DA Localization'
37
56
38
57
test_payload_labels $label_worth $label_feature
39
-
test "$(categorize)" = 'CA Features'
58
+
test "$(categorize)" = 'EA Features'
40
59
41
60
test_payload_labels $label_worth $label_bug
42
-
test "$(categorize)" = 'CB Bug fixes'
43
-
44
-
test_payload_labels $label_worth $label_localization
45
-
test "$(categorize)" = 'DA Localization'
61
+
test "$(categorize)" = 'EB Bug fixes'
46
62
47
63
test_payload_labels $label_worth
48
64
test "$(categorize)" = 'ZE Other changes without a feature or bug label'
···
50
66
test_payload_labels
51
67
test "$(categorize)" = 'ZF Included for completeness but not worth a release note'
52
68
69
+
test_payload_draft "fix(security)!: breaking security bug fix"
70
+
test "$(categorize)" = 'AA Breaking security bug fixes'
71
+
72
+
test_payload_draft "fix(security): security bug fix"
73
+
test "$(categorize)" = 'AB Security bug fixes'
74
+
53
75
test_payload_draft "feat!: breaking feature"
54
-
test "$(categorize)" = 'AA Breaking features'
76
+
test "$(categorize)" = 'BA Breaking features'
55
77
56
78
test_payload_draft "fix!: breaking bug fix"
57
-
test "$(categorize)" = 'AB Breaking bug fixes'
79
+
test "$(categorize)" = 'BB Breaking bug fixes'
58
80
59
81
test_payload_draft "feat: feature"
60
-
test "$(categorize)" = 'CA Features'
82
+
test "$(categorize)" = 'EA Features'
61
83
62
84
test_payload_draft "fix: bug fix"
63
-
test "$(categorize)" = 'CB Bug fixes'
85
+
test "$(categorize)" = 'EB Bug fixes'
64
86
65
87
test_payload_draft "something with no prefix"
66
88
test "$(categorize)" = 'ZE Other changes without a feature or bug label'
···
109
131
is_feature=false
110
132
is_localization=false
111
133
is_breaking=false
134
+
is_security=false
112
135
113
136
#
114
137
# first try to figure out the category from the labels
···
126
149
esac
127
150
128
151
case "$labels" in
152
+
*$label_security*)
153
+
is_security=true
154
+
;;
155
+
esac
156
+
157
+
case "$labels" in
129
158
*$label_breaking*)
130
159
is_breaking=true
131
160
;;
···
143
172
if ! $is_bug && ! $is_feature; then
144
173
draft="$(jq --raw-output .Draft <$payload)"
145
174
case "$draft" in
175
+
fix\(security\)!:*)
176
+
is_bug=true
177
+
is_breaking=true
178
+
is_security=true
179
+
;;
180
+
fix\(security\):*)
181
+
is_bug=true
182
+
is_security=true
183
+
;;
146
184
fix!:*)
147
185
is_bug=true
148
186
is_breaking=true
···
171
209
fi
172
210
fi
173
211
174
-
if $is_breaking; then
212
+
if $is_security; then
213
+
if $is_bug; then
214
+
if $is_breaking; then
215
+
echo -n AA Breaking security bug fixes
216
+
else
217
+
echo -n AB Security bug fixes
218
+
fi
219
+
elif $is_feature; then
220
+
if $is_breaking; then
221
+
echo -n AC Breaking security features
222
+
else
223
+
echo -n AD Security features
224
+
fi
225
+
else
226
+
echo -n ZA Security changes without a feature or bug label
227
+
fi
228
+
elif $is_breaking; then
175
229
if $is_feature; then
176
-
echo -n AA Breaking features
230
+
echo -n BA Breaking features
177
231
elif $is_bug; then
178
-
echo -n AB Breaking bug fixes
232
+
echo -n BB Breaking bug fixes
179
233
else
180
-
echo -n ZC Breaking changes without a feature or bug label
234
+
echo -n ZB Breaking changes without a feature or bug label
181
235
fi
182
236
elif $is_ui; then
183
237
if $is_feature; then
184
-
echo -n BA User Interface features
238
+
echo -n CA User Interface features
185
239
elif $is_bug; then
186
-
echo -n BB User Interface bug fixes
240
+
echo -n CB User Interface bug fixes
187
241
else
188
-
echo -n ZD User Interface changes without a feature or bug label
242
+
echo -n ZC User Interface changes without a feature or bug label
189
243
fi
190
244
elif $is_localization; then
191
245
echo -n DA Localization
192
246
else
193
247
if $is_feature; then
194
-
echo -n CA Features
248
+
echo -n EA Features
195
249
elif $is_bug; then
196
-
echo -n CB Bug fixes
250
+
echo -n EB Bug fixes
197
251
else
198
252
echo -n ZE Other changes without a feature or bug label
199
253
fi