diff --git a/.github/workflows/verify-changelog.yaml b/.github/workflows/verify-changelog.yaml new file mode 100644 index 00000000000..5f4a59503dd --- /dev/null +++ b/.github/workflows/verify-changelog.yaml @@ -0,0 +1,44 @@ +# This action requires that any PR targeting the main branch should touch at +# least one CHANGELOG file. If a CHANGELOG entry is not required, add the +# "Skip Changelog" label, the "dependencies" label, or include "[chore]" in +# the PR title. + +name: Verify CHANGELOG + +on: + pull_request: + types: [opened, synchronize, reopened, labeled, unlabeled] + branches: + - main + +permissions: read-all + +jobs: + changelog: + runs-on: ubuntu-latest + + # Skip if: + # - PR has "Skip Changelog" label + # - PR has "dependencies" label + # - PR title contains "[chore]" + if: > + ! contains(github.event.pull_request.labels.*.name, 'Skip Changelog') && + ! contains(github.event.pull_request.labels.*.name, 'dependencies') && + ! contains(github.event.pull_request.title, '[chore]') + + steps: + - name: Checkout repository + uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1 + with: + fetch-depth: 0 + + - name: Verify CHANGELOG updated + run: | + echo "Checking for CHANGELOG modifications..." + if git diff --name-only --merge-base origin/${{ github.base_ref }} | grep -q 'CHANGELOG'; then + echo "CHANGELOG updated — OK" + else + echo "::error::No CHANGELOG file was updated in this PR." + echo "Please update CHANGELOG or use the 'Skip Changelog' label if appropriate." + false + fi