Skip to content

Commit c43f366

Browse files
committed
Add CI changelog check
1 parent a82b4f4 commit c43f366

1 file changed

Lines changed: 59 additions & 0 deletions

File tree

Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
name: ci_changelog_check
2+
3+
# Runs on every PR event that could change which files are included.
4+
# 'labeled' and 'unlabeled' are needed so that adding/removing the
5+
# 'no-changelog' label immediately re-evaluates the check.
6+
on:
7+
pull_request:
8+
branches:
9+
- main
10+
types:
11+
- opened
12+
- reopened
13+
- synchronize
14+
- labeled
15+
- unlabeled
16+
17+
permissions:
18+
contents: read
19+
pull-requests: read
20+
21+
jobs:
22+
changelog_check:
23+
runs-on: ubuntu-latest
24+
name: Check Changelog Entry
25+
26+
# Skip the whole job (shows as "skipped" = passing) when a maintainer
27+
# has deliberately labelled the PR 'no-changelog'.
28+
# Typical use-cases: CI-only fixes, typo corrections, dependency bumps.
29+
if: "!contains(github.event.pull_request.labels.*.name, 'no-changelog')"
30+
31+
steps:
32+
- name: Checkout repository
33+
uses: actions/checkout@v7
34+
with:
35+
# Full history is required so tj-actions/changed-files can compare
36+
# the PR branch against the base branch correctly.
37+
fetch-depth: 0
38+
39+
- name: Detect changed files
40+
id: changed_files
41+
uses: tj-actions/changed-files@v47
42+
with:
43+
# Check CHANGELOG.md and CHANGELOG_CONJUGATE.md.
44+
files: CHANGELOG*.md
45+
46+
- name: Fail — no changelog entry found
47+
if: steps.changed_files.outputs.any_changed == 'false'
48+
run: |
49+
echo "::error file=CHANGELOG.md::Missing changelog entry. Please add one before merging."
50+
echo ""
51+
echo "Every user-facing pull request must include an update to CHANGELOG.md"
52+
echo "or CHANGELOG_CONJUGATE.md. If this PR genuinely does not need a changelog"
53+
echo "entry (e.g. a CI fix, a typo correction, or a dependency bump), ask a"
54+
echo "maintainer to add the 'no-changelog' label to skip this check."
55+
exit 1
56+
57+
- name: Pass — changelog entry found
58+
if: steps.changed_files.outputs.any_changed == 'true'
59+
run: echo "CHANGELOG.md or CHANGELOG_CONJUGATE.md was updated. Check passed."

0 commit comments

Comments
 (0)