name: Pull Request Changelog Policy

on:
  pull_request:
    types:
      - opened
      - synchronize
      - reopened
      - ready_for_review
      - labeled
      - unlabeled

concurrency:
  group: ${{ github.workflow }}-${{ github.event.pull_request.number }}
  cancel-in-progress: true

permissions:
  contents: read
  pull-requests: read

jobs:
  changelog:
    name: Changelog Policy
    runs-on: ubuntu-latest
    timeout-minutes: 5
    steps:
      - name: Enforce changelog update
        uses: dangoslen/changelog-enforcer@8b5e9dc3121363bb7c0115f8533404d92af382de # v3.7.0
        env:
          NODE_OPTIONS: --no-deprecation
        with:
          changeLogPath: CHANGELOG.md
          skipLabels: "skip changelog"
          missingUpdateErrorMessage: >-
            Update CHANGELOG.md under Unreleased, or apply the "skip changelog"
            label if this PR does not need a changelog entry.
