-
Notifications
You must be signed in to change notification settings - Fork 168
134 lines (129 loc) · 5.03 KB
/
changelog_generator.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
---
name: GitHub_Changelog_Generator
on:
push:
branches: ["master"]
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
github_changelog_generator:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Ruby
uses: ruby/setup-ruby@v1
with:
ruby-version: '3.2'
- name: Install dependencies
run: |
gem install github_changelog_generator
- name: Check version
run: |
github_changelog_generator --version
- name: Build changelog
run: |
mkdir ~/changelog_build
github_changelog_generator \
--exclude-tags-regex "^(?!v).*?$" \
--user bids-standard \
--project bids-specification \
--token ${{ secrets.GITHUB_TOKEN }} \
--output ~/changelog_build/CHANGES.md \
--header-label "# Changelog" \
--release-branch master \
--no-issues \
--no-filter-by-milestone \
--no-compare-link \
--pr-label "" \
--enhancement-label "" \
--bugs-label "" \
--exclude-labels "exclude-from-changelog"
- name: Append changelog from pre-GitHub times
run: |
cat ${{ github.workspace }}/src/pregh-changes.md >> ~/changelog_build/CHANGES.md
- name: Remove the inserted advert from the file
run: |
sed -i '/This Changelog was automatically generated by/d' ~/changelog_build/CHANGES.md
- name: Print out complete changelog
run: |
cat ~/changelog_build/CHANGES.md
- name: Archive changelog
uses: actions/upload-artifact@v4
with:
name: changelog_pre_lint
path: |
~/changelog_build/CHANGES.md
lint_generated_changelog:
needs: github_changelog_generator
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Download previously build changelog
uses: actions/download-artifact@v4
with:
name: changelog_pre_lint
path: ~/changelog_build
- name: Set up Node
uses: actions/setup-node@v4
with:
node-version: 20
- name: Install remark and extensions
run: |
npm install `cat npm-requirements.txt`
- name: Remark on autogenerated CHANGES.md
# first remove empty lines
# then run remark to re-organize
# replace remark's bullet list "*" with "-"
# final run of remark to check everything passes now
run: |
head -n 25 ~/changelog_build/CHANGES.md
sed -i '/^$/d' ~/changelog_build/CHANGES.md
echo $'\n------------------------------\n'
head -n 25 ~/changelog_build/CHANGES.md
npx remark ~/changelog_build/CHANGES.md --rc-path ${{ github.workspace }}/.remarkrc --output ~/changelog_build/CHANGES.md --quiet
echo $'\n------------------------------\n'
head -n 25 ~/changelog_build/CHANGES.md
sed -i 's/^* /- /' ~/changelog_build/CHANGES.md
echo $'\n------------------------------\n'
head -n 25 ~/changelog_build/CHANGES.md
npx remark ~/changelog_build/CHANGES.md --rc-path ${{ github.workspace }}/.remarkrc --frail --quiet --no-stdout
- name: Archive linted changelog
uses: actions/upload-artifact@v4
with:
name: changelog_post_lint
path: |
~/changelog_build/CHANGES.md
commit_generated_changelog:
permissions:
contents: write
pull-requests: write
needs: lint_generated_changelog
# Run only if the head commit message contains "[build changelog]""
if: contains(github.event.head_commit.message, '[build changelog]')
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Download previously build changelog
uses: actions/download-artifact@v4
with:
name: changelog_post_lint
path: ~/changelog_build
- name: add changelog to git
run: |
mv ~/changelog_build/CHANGES.md ${{ github.workspace }}/src/CHANGES.md
git config credential.helper 'cache --timeout=120'
git config user.email "[email protected]"
git config user.name "bids-maintenance"
git add ${{ github.workspace }}/src/CHANGES.md
git commit -m "[DOC] Auto-generated changelog entry"
- name: Create Pull Request
uses: peter-evans/create-pull-request@v7
with:
token: ${{ secrets.GITHUB_TOKEN }}
branch: changelog_generator_update
delete-branch: true
title: '[DOC] Auto-generated changelog entry'
labels: |
exclude-from-changelog
draft: false