-
Notifications
You must be signed in to change notification settings - Fork 10
39 lines (33 loc) · 1.33 KB
/
check-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
name: Changelog Check
on:
pull_request:
types: [opened, synchronize, reopened, labeled, unlabeled]
jobs:
changelog-check:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
with:
fetch-depth: 2 # Only need preceeding commit
- name: Check for no-changelog label
id: label-check
uses: actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea # v7.0.1
with:
script: |
const payload = context.payload;
const label = !!payload.pull_request.labels.find(l => l.name === 'no-changelog');
core.setOutput('has_label', label.toString());
- name: Check if CHANGELOG.md was modified
id: changelog-check
if: steps.label-check.outputs.has_label == 'false'
uses: tj-actions/changed-files@c3a1bb2c992d77180ae65be6ae6c166cf40f857c # v45.0.3
with:
files: |
CHANGELOG.md
- name: Assert CHANGELOG.md is modified
uses: actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea # v7.0.1
if: steps.label-check.outputs.has_label == 'false' && steps.changelog-check.outputs.any_changed != 'true'
with:
script: |
core.setFailed("No changes to CHANGELOG.md detected. Add 'no-changelog' label if this is intentional.")