Change Claude Code review to on-demand triggers (#25)

* 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.

* Remove unreachable workflow_call event check

workflow_call invocations inherit the caller's event_name, so
github.event_name == 'workflow_call' never matches. The caller's
event context passes through and is handled by the existing
issue_comment/review_requested conditions.

* Fix workflow_call invocations being silently skipped

Add a direct_call boolean input (defaults to true) to workflow_call
so reusable workflow callers bypass the event-specific filtering gate.
Without this, callers triggered by e.g. pull_request opened would
hit the pull_request branch which requires requested_team.slug == 'claude',
causing a silent no-op.
This commit is contained in:
Adam Moussa 2026-05-13 16:27:18 -04:00 • committed by GitHub
parent b1b341afe5
commit 5d0349dfa3
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -7,9 +7,18 @@ on:
description: Pull request number to review
required: true
type: string
issue_comment:
types: [created]
pull_request_review_comment:
types: [created]
pull_request:
types: [opened, ready_for_review]
types: [review_requested]
workflow_call:
inputs:
direct_call:
description: Bypass event filtering (set automatically for reusable workflow callers)
type: boolean
default: true
secrets:
anthropic_api_key:
required: true
@ -17,11 +26,21 @@ on:
permissions:
contents: read
pull-requests: write
issues: read
id-token: write
jobs:
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' ||
inputs.direct_call == true
runs-on: ubuntu-latest
timeout-minutes: 10
steps:
@ -33,9 +52,10 @@ jobs:
with:
anthropic_api_key: ${{ secrets.anthropic_api_key || secrets.ANTHROPIC_API_KEY }}
allowed_bots: '*'
trigger_phrase: '@claude'
prompt: |
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:
- Bugs or logic errors