Add changelog rule to CI #1
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # .github/workflows/changelog-check.yml | |
| # Requires CHANGELOG.md to be updated in every PR unless | |
| # the PR has the "skip-changelog" label applied. | |
| name: Changelog check | |
| on: | |
| pull_request: | |
| branches: [main] | |
| types: [opened, synchronize, reopened, labeled, unlabeled] | |
| jobs: | |
| changelog: | |
| name: Changelog updated | |
| runs-on: self-hosted | |
| steps: | |
| - name: Skip if labeled | |
| if: contains(github.event.pull_request.labels.*.name, 'skip-changelog') | |
| run: echo "skip-changelog label found, skipping check" | |
| - uses: actions/checkout@v6 | |
| if: "!contains(github.event.pull_request.labels.*.name, 'skip-changelog')" | |
| with: | |
| fetch-depth: 0 | |
| - name: Check CHANGELOG.md was modified | |
| if: "!contains(github.event.pull_request.labels.*.name, 'skip-changelog')" | |
| run: | | |
| if git diff --name-only origin/main...HEAD | grep -q 'CHANGELOG.md'; then | |
| echo "CHANGELOG.md updated" | |
| else | |
| echo "::error::Please add an entry to CHANGELOG.md under [Unreleased], or add the 'skip-changelog' label if this change is not user-facing." | |
| exit 1 | |
| fi |