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@fe104658747b27e96e4f7e80cd0a94068e53901d # v2.16.1
        with:
          egress-policy: audit

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