From 5d0349dfa38ba0ee99ee6349749bbe418a8b4490 Mon Sep 17 00:00:00 2001 From: Adam Moussa <166072409+amoussa1229@users.noreply.github.com> Date: Wed, 13 May 2026 16:27:18 -0400 Subject: [PATCH] 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. --- .github/workflows/claude-code-review.yaml | 26 ++++++++++++++++++++--- 1 file changed, 23 insertions(+), 3 deletions(-) diff --git a/.github/workflows/claude-code-review.yaml b/.github/workflows/claude-code-review.yaml index dd78d3f..4c53cae 100644 --- a/.github/workflows/claude-code-review.yaml +++ b/.github/workflows/claude-code-review.yaml @@ -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