-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathaction.yml
More file actions
232 lines (222 loc) · 10.1 KB
/
action.yml
File metadata and controls
232 lines (222 loc) · 10.1 KB
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
#
# Copyright 2023 ABSA Group Limited
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
name: 'Release notes scraper'
description: 'Automatically generates release notes for a given release tag, categorized into chapters based on labels.'
inputs:
tag-name:
description: 'The tag name of the release to generate notes for.'
required: true
chapters:
description: |
YAML array of chapter definitions. Required keys: `title`, `label` or `labels`.
Optional keys: `hidden` (bool), `order` (int), `catch-open-hierarchy` (bool).
`catch-open-hierarchy: true` — intercepts open hierarchy parents before label routing; requires `hierarchy: true`.
Chapters with `catch-open-hierarchy` do not require `label`/`labels` (optional interception filter).
At most one `catch-open-hierarchy` chapter allowed; duplicates are warned and ignored.
required: false
default: ''
super-chapters:
description: |
YAML array of super-chapter definitions that group regular chapters by label.
Required keys: `title`, `label` or `labels`.
Records matching a super-chapter label are rendered inside that super-chapter.
A record can appear in multiple super-chapters.
required: false
default: ''
duplicity-scope:
description: 'Allow duplicity of issue lines in chapters. Scopes: custom, service, both, none.'
required: false
default: 'both'
from-tag-name:
description: 'The tag name of the previous release to use as a start reference point for the current release notes.'
required: false
default: ''
hierarchy:
description: 'Use hierarchy of issues and pull requests.'
required: false
default: 'false'
duplicity-icon:
description: 'Icon to be used for duplicity warning. Icon is placed before the record line.'
required: false
default: '🔔'
open-hierarchy-sub-issue-icon:
description: 'Icon prepended to open children under a closed hierarchy parent.'
required: false
default: '🟡'
published-at:
description: 'Use `published-at` timestamp instead of `created-at` as the reference point of previous Release.'
required: false
default: 'false'
skip-release-notes-labels:
description: 'List labels used for detection if issues or pull requests are ignored in the Release Notes generation process.'
required: false
default: 'skip-release-notes'
warnings:
description: 'Print service chapters if true.'
required: false
default: 'true'
hidden-service-chapters:
description: |
List of service chapter titles to hide from output (comma or newline separated).
Title matching is exact and case-sensitive.
Example: "Direct Commits ⚠️, Others - No Topic ⚠️"
Available service chapters:
- "Closed Issues without Pull Request ⚠️"
- "Closed Issues without User Defined Labels ⚠️"
- "Merged PRs without Issue and User Defined Labels ⚠️"
- "Closed PRs without Issue and User Defined Labels ⚠️"
- "Merged PRs Linked to 'Not Closed' Issue ⚠️"
- "Direct Commits ⚠️"
- "Others - No Topic ⚠️"
required: false
default: ''
service-chapter-order:
description: |
Custom display order for service chapters (comma or newline separated).
Title matching is exact and case-sensitive.
Listed chapters are rendered first in the given order; unlisted chapters
are appended afterward in the default order.
If omitted, the default order is used.
Available service chapter titles:
- "Closed Issues without User Defined Labels ⚠️"
- "Closed Issues without Pull Request ⚠️"
- "Merged PRs without Issue and User Defined Labels ⚠️"
- "Closed PRs without Issue and User Defined Labels ⚠️"
- "Merged PRs Linked to 'Not Closed' Issue ⚠️"
- "Direct commits ⚠️"
- "Others - No Topic ⚠️"
required: false
default: ''
service-chapter-exclude:
description: |
YAML mapping of service chapter title to label-exclusion groups.
Each group is a list of labels (AND logic within a group).
Multiple groups per chapter are evaluated with OR logic.
Use the reserved key "*" to define global rules that apply to all service chapters.
Example:
service-chapter-exclude: |
"*":
- [scope:security, type:tech-debt]
Closed Issues without Pull Request ⚠️:
- [scope:security, type:false-positive]
required: false
default: ''
print-empty-chapters:
description: 'Print chapters even if they are empty.'
required: false
default: 'true'
verbose:
description: 'Print verbose logs.'
required: false
default: 'false'
release-notes-title:
description: 'The title of the release notes section in the PR body. Value supports regex.'
required: false
default: '[Rr]elease [Nn]otes:'
coderabbit-support-active:
description: 'Enable CodeRabbit support. If true, the action will use CodeRabbit to generate release notes.'
required: false
default: 'false'
coderabbit-release-notes-title:
description: 'The title of the CodeRabbit summary in the PR body. Value supports regex.'
required: false
default: 'Summary by CodeRabbit'
coderabbit-summary-ignore-groups:
description: 'List of "group names" to be ignored by release notes detection logic.'
required: false
default: ''
row-format-hierarchy-issue:
description: 'Format of the hierarchy issue in the release notes. Available placeholders: {type}, {number}, {title}, {author}, {assignees}, {developers}. Placeholders are case-insensitive.'
required: false
default: '{type}: _{title}_ {number} {progress}'
row-format-issue:
description: 'Format of the issue row in the release notes. Available placeholders: {type}, {number}, {title}, {author}, {assignees}, {developers}, {pull-requests}. Placeholders are case-insensitive.'
required: false
default: '{type}: {number} _{title}_ developed by {developers} in {pull-requests}'
row-format-pr:
description: 'Format of the pr row in the release notes. Available placeholders: {number}, {title}, {developers}. Placeholders are case-insensitive.'
required: false
default: '{number} _{title}_ developed by {developers}'
row-format-link-pr:
description: 'Add prefix "PR:" before link to PR when not linked an Issue.'
required: false
default: 'true'
outputs:
release-notes:
description: 'Generated release notes.'
value: ${{ steps.release-notes-generator.outputs.release-notes }}
branding:
icon: 'book'
color: 'yellow'
runs:
using: 'composite'
steps:
# setup-python is not called as it is expected that it was done in the workflow that uses this action
- name: Install Python dependencies
run: |
python_version=$(python --version 2>&1 | grep -oP '\d+\.\d+\.\d+')
minimal_required_version="3.14.0"
function version { echo "$@" | awk -F. '{ printf("%d%03d%03d\n", $1,$2,$3); }'; }
echo "Current Python version: $python_version"
echo "Minimal required Python version: $minimal_required_version"
if [ $(version $python_version) -lt $(version $minimal_required_version) ]; then
echo "Python version is less than $minimal_required_version"
exit 1
else
echo "Python version meets the minimum requirement of $minimal_required_version"
fi
python -m venv .venv
source .venv/bin/activate
pip install -r ${{ github.action_path }}/requirements.txt
shell: bash
- name: Update PYTHONPATH
run: |
ACTION_ROOT="${{ github.action_path }}"
echo PYTHONPATH="${PYTHONPATH}:${ACTION_ROOT}/release_notes_generator" >> $GITHUB_ENV
shell: bash
- name: Call Release Notes Generator
id: release-notes-generator
env:
INPUT_GITHUB_TOKEN: ${{ env.GITHUB_TOKEN }}
INPUT_TAG_NAME: ${{ inputs.tag-name }}
INPUT_CHAPTERS: ${{ inputs.chapters }}
INPUT_SUPER_CHAPTERS: ${{ inputs.super-chapters }}
INPUT_FROM_TAG_NAME: ${{ inputs.from-tag-name }}
INPUT_HIERARCHY: ${{ inputs.hierarchy }}
INPUT_DUPLICITY_SCOPE: ${{ inputs.duplicity-scope }}
INPUT_DUPLICITY_ICON: ${{ inputs.duplicity-icon }}
INPUT_OPEN_HIERARCHY_SUB_ISSUE_ICON: ${{ inputs.open-hierarchy-sub-issue-icon }}
INPUT_WARNINGS: ${{ inputs.warnings }}
INPUT_HIDDEN_SERVICE_CHAPTERS: ${{ inputs.hidden-service-chapters }}
INPUT_SERVICE_CHAPTER_ORDER: ${{ inputs.service-chapter-order }}
INPUT_SERVICE_CHAPTER_EXCLUDE: ${{ inputs.service-chapter-exclude }}
INPUT_PUBLISHED_AT: ${{ inputs.published-at }}
INPUT_SKIP_RELEASE_NOTES_LABELS: ${{ inputs.skip-release-notes-labels }}
INPUT_PRINT_EMPTY_CHAPTERS: ${{ inputs.print-empty-chapters }}
INPUT_VERBOSE: ${{ inputs.verbose }}
INPUT_RELEASE_NOTES_TITLE: ${{ inputs.release-notes-title }}
INPUT_CODERABBIT_SUPPORT_ACTIVE: ${{ inputs.coderabbit-support-active }}
INPUT_CODERABBIT_RELEASE_NOTES_TITLE: ${{ inputs.coderabbit-release-notes-title }}
INPUT_CODERABBIT_SUMMARY_IGNORE_GROUPS: ${{ inputs.coderabbit-summary-ignore-groups }}
INPUT_GITHUB_REPOSITORY: ${{ github.repository }}
INPUT_ROW_FORMAT_HIERARCHY_ISSUE: ${{ inputs.row-format-hierarchy-issue }}
INPUT_ROW_FORMAT_ISSUE: ${{ inputs.row-format-issue }}
INPUT_ROW_FORMAT_PR: ${{ inputs.row-format-pr }}
INPUT_ROW_FORMAT_LINK_PR: ${{ inputs.row-format-link-pr }}
run: |
source .venv/bin/activate
python ${{ github.action_path }}/main.py
shell: bash