name: Handle Comment Commands
on:
  issue_comment:
    types: [created]

jobs:
  handle-comment:
    # Only run on comments on PRs, and only on commands starting with "@bazel-io ".
    if: github.event.issue.pull_request && startsWith(github.event.comment.body, '@bazel-io ')
    runs-on: ubuntu-latest
    steps:
      - name: Harden Runner
        uses: step-security/harden-runner@95d9a5deda9de15063e7595e9719c11c38c90ae2 # v2.13.2
        with:
          egress-policy: audit

      - name: Handle @bazel-io commands
        uses: bazelbuild/continuous-integration/actions/bcr-pr-reviewer@fab99709d5f9e991e58dcaa1675b2263df07b836
        with:
          # This token needs to be updated annually on Feb 05.
          token: ${{ secrets.BCR_PR_REVIEW_HELPER_TOKEN }}
          action-type: 'handle_comment'
