From e37cf005536f8077cd5a9644228b46e523e73b62 Mon Sep 17 00:00:00 2001 From: Daniel Nicholson Date: Mon, 23 Feb 2026 15:42:33 +0000 Subject: [PATCH] fix(review): only trigger on PR open and explicit user request Previously the review workflow fired on every push to a PR (synchronize), which created noise and wasted API calls. Now it only runs when: - A PR is opened or converted from draft to ready for review - A user explicitly comments `@claude review` on the PR The interactive workflow is updated to exclude `@claude review` comments so only the review workflow fires for that trigger phrase. Co-Authored-By: Claude Sonnet 4.6 --- .github/workflows/claude-interactive.yml | 2 +- .github/workflows/claude-review.yml | 21 +++++++++++++++------ 2 files changed, 16 insertions(+), 7 deletions(-) diff --git a/.github/workflows/claude-interactive.yml b/.github/workflows/claude-interactive.yml index 13dd29f..d06c7c7 100644 --- a/.github/workflows/claude-interactive.yml +++ b/.github/workflows/claude-interactive.yml @@ -20,7 +20,7 @@ permissions: jobs: claude: if: > - (github.event_name == 'issue_comment' && contains(github.event.comment.body, '@claude')) + (github.event_name == 'issue_comment' && contains(github.event.comment.body, '@claude') && !startsWith(github.event.comment.body, '@claude review')) || (github.event_name == 'pull_request_review_comment' && contains(github.event.comment.body, '@claude')) || (github.event_name == 'pull_request_review' && contains(github.event.review.body, '@claude')) || (github.event_name == 'issues' && (contains(github.event.issue.body, '@claude') || contains(github.event.issue.title, '@claude'))) diff --git a/.github/workflows/claude-review.yml b/.github/workflows/claude-review.yml index cd7b1e9..5c9a6ae 100644 --- a/.github/workflows/claude-review.yml +++ b/.github/workflows/claude-review.yml @@ -2,7 +2,9 @@ name: Claude Code Review on: pull_request: - types: [opened, synchronize, ready_for_review, reopened] + types: [opened, ready_for_review] + issue_comment: + types: [created] permissions: contents: read @@ -13,18 +15,25 @@ permissions: jobs: claude-review: - # Skip draft PRs; allow claude[bot] but skip other bots + # Auto-review when PR is opened or marked ready for review (skip drafts and bots). + # Re-review when a user comments '@claude review' on a PR. if: > - (github.event.pull_request.user.type != 'Bot' || - github.event.pull_request.user.login == 'claude[bot]') && - github.event.pull_request.draft == false + ( + github.event_name == 'pull_request' && + (github.event.pull_request.user.type != 'Bot' || github.event.pull_request.user.login == 'claude[bot]') && + github.event.pull_request.draft == false + ) || ( + github.event_name == 'issue_comment' && + github.event.issue.pull_request != null && + startsWith(github.event.comment.body, '@claude review') + ) runs-on: ubuntu-latest steps: - uses: actions/checkout@v6 - uses: ./ with: mode: review - pr_number: ${{ github.event.pull_request.number }} + pr_number: ${{ github.event_name == 'pull_request' && github.event.pull_request.number || github.event.issue.number }} claude_code_oauth_token: ${{ secrets.CLAUDE_CODE_OAUTH_TOKEN }} allowed_bots: "claude[bot]" # Optional: Enable progress tracking with checkboxes