# This action against that any PR targeting the main branch touches released
# sections in CHANGELOG file. If change to released CHANGELOG is required, like
# doing a release, add the \"Unlock Released Changelog\" label to disable this action.

name: Protect released changelog

on:
  pull_request:
    types: [opened, synchronize, reopened, labeled, unlabeled]

# Declare default permissions as read only.
permissions: read-all

jobs:
  protect-released-changelog:
    runs-on: ubuntu-latest
    if: ${{ !contains(github.event.pull_request.labels.*.name, 'Unlock Released Changelog')}}

    steps:
      - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2

      - name: Protect the released changelog
        run: |
          ./verify_released_changelog.sh ${{ github.base_ref }}
