Change Claude Code review to on-demand via @claude or review request

Replace automatic PR triggers (opened, ready_for_review) with on-demand
triggers: @claude mentions in PR comments, inline review comments, and
review requests from the 'claude' team.
This commit is contained in:
Adam Moussa 2026-05-13 16:04:41 -04:00
parent b1b341afe5
commit 23e8370c5a

View file

@ -7,8 +7,12 @@ on:
description: Pull request number to review description: Pull request number to review
required: true required: true
type: string type: string
issue_comment:
types: [created]
pull_request_review_comment:
types: [created]
pull_request: pull_request:
types: [opened, ready_for_review] types: [review_requested]
workflow_call: workflow_call:
secrets: secrets:
anthropic_api_key: anthropic_api_key:
@ -17,11 +21,21 @@ on:
permissions: permissions:
contents: read contents: read
pull-requests: write pull-requests: write
issues: read
id-token: write id-token: write
jobs: jobs:
claude-review: claude-review:
if: github.event.pull_request.draft == false if: >-
(github.event_name == 'issue_comment' &&
contains(github.event.comment.body, '@claude') &&
github.event.issue.pull_request) ||
(github.event_name == 'pull_request_review_comment' &&
contains(github.event.comment.body, '@claude')) ||
(github.event_name == 'pull_request' &&
github.event.requested_team.slug == 'claude') ||
github.event_name == 'workflow_dispatch' ||
github.event_name == 'workflow_call'
runs-on: ubuntu-latest runs-on: ubuntu-latest
timeout-minutes: 10 timeout-minutes: 10
steps: steps:
@ -33,9 +47,10 @@ jobs:
with: with:
anthropic_api_key: ${{ secrets.anthropic_api_key || secrets.ANTHROPIC_API_KEY }} anthropic_api_key: ${{ secrets.anthropic_api_key || secrets.ANTHROPIC_API_KEY }}
allowed_bots: '*' allowed_bots: '*'
trigger_phrase: '@claude'
prompt: | prompt: |
REPO: ${{ github.repository }} REPO: ${{ github.repository }}
PR NUMBER: ${{ github.event.pull_request.number || github.event.inputs.pr_number }} PR NUMBER: ${{ github.event.pull_request.number || github.event.issue.number || github.event.inputs.pr_number }}
Review this pull request. Only comment on: Review this pull request. Only comment on:
- Bugs or logic errors - Bugs or logic errors