-
Notifications
You must be signed in to change notification settings - Fork 0
/
action.yml
128 lines (118 loc) · 4.9 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
#
# 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 scrapper'
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: 'JSON string defining chapters and corresponding labels for categorization.'
required: false
duplicity-scope:
description: 'Allow duplicity of issue lines in chapters. Scopes: custom, service, both, none.'
required: false
default: 'both'
duplicity-icon:
description: 'Icon to be used for duplicity warning. Icon is placed before the record line.'
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-label:
description: 'Skip label used for detection of issues or pull requests to ignore in Release Notes generation process.'
required: false
default: 'skip-release-notes'
warnings:
description: 'Print service chapters if true.'
required: false
default: 'true'
print-empty-chapters:
description: 'Print chapters even if they are empty.'
required: false
default: 'true'
verbose:
description: 'Print verbose logs.'
required: false
default: 'false'
row-format-issue:
description: 'Format of the issue row in the release notes. Available placeholders: {number}, {title}, {pull-requests}. Placeholders are case-insensitive.'
required: false
default: '{number} _{title}_ in {pull-requests}'
row-format-pr:
description: 'Format of the pr row in the release notes. Available placeholders: {number}, {title}, {pull-requests}. Placeholders are case-insensitive.'
required: false
default: '{number} _{title}_'
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.11.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: Set PROJECT_ROOT and update PYTHONPATH
run: |
ACTION_ROOT="${{ github.action_path }}"
export PYTHONPATH="${PYTHONPATH}:${ACTION_ROOT}/release_notes_generator"
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_DUPLICITY_SCOPE: ${{ inputs.duplicity-scope }}
INPUT_DUPLICITY_ICON: ${{ inputs.duplicity-icon }}
INPUT_WARNINGS: ${{ inputs.warnings }}
INPUT_PUBLISHED_AT: ${{ inputs.published-at }}
INPUT_SKIP_RELEASE_NOTES_LABEL: ${{ inputs.skip-release-notes-label }}
INPUT_PRINT_EMPTY_CHAPTERS: ${{ inputs.print-empty-chapters }}
INPUT_VERBOSE: ${{ inputs.verbose }}
INPUT_GITHUB_REPOSITORY: ${{ github.repository }}
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