name: Parsetree Updated

on:
  pull_request:
    paths:
      - 'parsing/parsetree.mli'
      - 'parsing/asttypes.mli'
      - 'parsing/location.mli'
      - 'parsing/longident.mli'
      - 'parsing/parse.mli'
      - 'parsing/pprintast.mli'

jobs:
  comment-and-label:
    if: ${{! contains(github.event.pull_request.labels.*.name, 'parsetree-change')}}
    permissions:
      pull-requests: write
    runs-on: ubuntu-latest
    steps:
      - name: Notify ppxlib maintainers
        uses: actions/github-script@v7
        with:
          script: |
            github.rest.issues.createComment({
              issue_number: context.issue.number,
              owner: context.repo.owner,
              repo: context.repo.repo,
              body: 'CC @ocaml/ppxlib-dev'
            })
      - name: Label PR
        uses: actions/github-script@v7
        with:
          script: |
            github.rest.issues.addLabels({
              issue_number: context.issue.number,
              owner: context.repo.owner,
              repo: context.repo.repo,
              labels: ['parsetree-change']
            })
