name: Pull Request Checks
on:
pull_request:
types: [opened, synchronize, reopened, labeled, unlabeled]
jobs:
changelog-check:
name: Verify CHANGELOG.md was modified
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Verify CHANGELOG.md was modified
env:
BASE_SHA: ${{ github.event.pull_request.base.sha }}
LABELS: ${{ toJson(github.event.pull_request.labels.*.name) }}
run: |
if echo "$LABELS" | grep -q "no-changelog"; then
echo "Skipping changelog check (no-changelog label)"
exit 0
fi
if git diff --name-only $BASE_SHA...HEAD \
| grep -qE "(^|/)CHANGELOG\.md$"; then
echo "CHANGELOG.md was modified"
exit 0
fi
echo "ERROR: CHANGELOG.md not modified. Update the changelog or ask a maintainer to apply the 'no-changelog' label."
exit 1