@@ -7,6 +7,22 @@ author: 'Sébastien Boulle'
7
7
branding :
8
8
icon : ' bookmark'
9
9
color : ' green'
10
+ inputs :
11
+ github_token :
12
+ description : |
13
+ The github token to be used to fetch the repository
14
+
15
+ Notes:
16
+ this will become required in the next version
17
+ tag_prefix :
18
+ description : if you tags follow the `prefix/version` pattern
19
+ required : false
20
+ path_filters :
21
+ description : |
22
+ A space separated list of git path blob regex to be used to filters the commits.
23
+ This can be used to keep only relevant commits by filtering on relevant files.
24
+ Example:
25
+ path_filters: "src/ doc/ tests/*/qa/*"
10
26
outputs :
11
27
changelog :
12
28
description : ' The generated changelog'
@@ -17,13 +33,30 @@ runs:
17
33
- name : Generate
18
34
id : generate
19
35
run : |
36
+ # install de dependencies
20
37
sudo apt-get install python3-wheel -y
21
38
pip3 install -r ${{ github.action_path }}/requirements.txt
39
+
40
+ # define the environment variables
22
41
export PYTHONPATH=${{ github.action_path }}:$PYTHONPATH
23
- export CHANGELOG=$(python3 -m changelog_generator)
24
- export CHANGELOG="${CHANGELOG//'%'/'%25'}"
25
- export CHANGELOG="${CHANGELOG//$'\n'/'%0A'}"
26
- export CHANGELOG="${CHANGELOG//$'\r'/'%0D'}"
42
+
43
+ # for retro-compatibility purpose. once github_token is required, then no need for the if
44
+ if test ! -z "${{ inputs.github_token }}"
45
+ then
46
+ export GITHUB_TOKEN=${{ inputs.github_token }}
47
+ fi
48
+
49
+ # generate the change log
50
+ CHANGELOG=$(python3 -m changelog_generator \
51
+ --tag_prefix ${{ inputs.tag_prefix }} \
52
+ --path_filters ${{ inputs.path_filters }} \
53
+ | tr '%' '%25' | tr '\n' '%0A' | tr '\r' '%0D'
54
+ )
55
+
56
+ # truncate the release note to not bloat the 65536 bytes max limit
57
+ CHANGELOG=${CHANGELOG:0:65200}
58
+
59
+ # output the changelog
27
60
echo "::set-output name=changelog::$CHANGELOG"
28
61
29
62
shell : bash
0 commit comments