name: Triage tasks

on: pull_request_target

concurrency:
  group: "triage-${{ github.event.number }}"
  cancel-in-progress: true

permissions:
  contents: read

jobs:
  triage:
    runs-on: ubuntu-latest
    steps:
      - name: Check commit format
        uses: Homebrew/actions/check-commit-format@master
        with:
          token: ${{secrets.HOMEBREW_GITHUB_PUBLIC_REPO_TOKEN}}
      - name: Label pull request
        uses: Homebrew/actions/label-pull-requests@master
        if: always()
        with:
          token: ${{secrets.HOMEBREW_GITHUB_PUBLIC_REPO_TOKEN}}
          def: |
            - label: cask deprecated
              path: Cask/.+
              content: \n  deprecate!.*\n

            - label: cask disabled
              path: Cask/.+
              content: \n  disable!.*\n

            - label: new cask
              status: added
              path: Casks/.+

            - label: marked for removal/rejection
              status: removed
              path: Casks/.+

            - label: documentation
              path: (.*\.md|\.github/ISSUE_TEMPLATE/.*\.yml)

            - label: bump-cask-pr
              pr_body_content: Created with `brew bump-cask-pr`

            - label: missing description
              path: Casks/.+
              missing_content: \n  desc .+\n

            - label: appcast migration needed
              path: Casks/.+
              content: \n  appcast .+\n

            - label: missing zap
              path: Casks/.+
              missing_content: zap .+\n
