-
Notifications
You must be signed in to change notification settings - Fork 21
55 lines (51 loc) · 1.69 KB
/
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
name: Changelog
on:
pull_request: {}
permissions:
pull-requests: read
jobs:
# Check for label in its own job to allow skipping multiple steps with 'success'
check-labels:
name: check labels
runs-on: ubuntu-latest
steps:
- id: check-labels
env:
OWNER: ${{ github.repository_owner }}
REPO_NAME: ${{ github.event.repository.name }}
PR_ID: ${{ github.event.pull_request.number }}
GH_TOKEN: ${{ github.token }}
run: |
labels="$(gh api repos/$OWNER/$REPO_NAME/pulls/$PR_ID --jq '.labels.[].name')"
if [[ $labels != *"skip changelog"* ]]; then
echo "needs_entry=true" >> "$GITHUB_OUTPUT"
else
echo "needs_entry=false" >> "$GITHUB_OUTPUT"
fi
outputs:
needs_entry: ${{ steps.check-labels.outputs.needs_entry }}
check-changelog-entry:
name: has changelog fragment
runs-on: ubuntu-latest
needs: check-labels
if: ${{ needs.check-labels.outputs.needs_entry == 'true' }}
steps:
- name: Checkout
uses: actions/checkout@v4
with:
# `towncrier check` needs full history to compare
fetch-depth: 0
- name: Setup Python
uses: actions/setup-python@v5
with:
python-version: '3.10'
- name: Install towncrier
run: |
pip install --upgrade pip
pip install towncrier
- name: Validate changelog
run: |
if ! towncrier check --compare-with origin/${{ github.base_ref }}; then
echo "Please add a change fragment; see https://github.com/epic-open-source/seismometer/blob/main/changelog/README.rst for details."
false
fi