-
Notifications
You must be signed in to change notification settings - Fork 27
76 lines (61 loc) · 1.98 KB
/
ci-changelog.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
# Reference:
# - https://github.com/actions/checkout
# - https://github.com/actions/setup-python
# - https://github.com/jwalton/gh-find-current-pr
# - https://github.com/snnaplab/get-labels-action
# - https://github.com/jitterbit/get-changed-files (don't use - abandoned repo?)
# - https://github.com/dorny/paths-filter
name: ci-changelog
on:
pull_request:
types: [opened, synchronize, reopened, labeled, unlabeled]
push:
branches:
- "!main"
- "v*x"
- "!conda-lock-auto-update"
- "!pre-commit-ci-update-config"
- "!dependabot/*"
workflow_dispatch:
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
changelog:
name: 'validate changelog'
runs-on: ubuntu-latest
defaults:
run:
shell: bash -l {0}
if: github.actor != 'pre-commit-ci[bot]'
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: actions/setup-python@v5
with:
python-version: '3.x'
- name: 'get PR number'
uses: jwalton/gh-find-current-pr@89ee5799558265a1e0e31fab792ebb4ee91c016b
id: pr
- name: 'get PR labels'
uses: snnaplab/get-labels-action@f426df40304808ace3b5282d4f036515f7609576
- name: 'filter changelog'
uses: dorny/paths-filter@de90cc6fb38fc0963ad72b210f1f284cd68cea36
id: changes
with:
filters: |
changelog:
- 'changelog/**'
list-files: 'csv'
- name: 'validate changelog'
if: ${{ ! contains(fromJSON(env.LABELS), 'skip changelog') }}
run: |
python -m pip install click towncrier
python -c "import sys; print(f'version = {sys.version}')"
towncrier --version
python ${SCRIPTS}/changelog.py "${PR}" "${CHANGELOG}"
env:
CHANGELOG: "${{ steps.changes.outputs.changelog_files }}"
PR: "${{ steps.pr.outputs.number }}"
SCRIPTS: "./.github/scripts"