From e030264fb264d6cea6b36b42e90bbcd67100573b Mon Sep 17 00:00:00 2001 From: David Diviny Date: Wed, 8 Apr 2026 08:40:42 +1000 Subject: [PATCH 1/3] Improve Claude review workflow --- .github/workflows/claude-code-review.yml | 63 ++++++++++++++++-------- 1 file changed, 42 insertions(+), 21 deletions(-) diff --git a/.github/workflows/claude-code-review.yml b/.github/workflows/claude-code-review.yml index b5e8cfd..f8d060e 100644 --- a/.github/workflows/claude-code-review.yml +++ b/.github/workflows/claude-code-review.yml @@ -2,32 +2,32 @@ name: Claude Code Review on: pull_request: - types: [opened, synchronize, ready_for_review, reopened] - # Optional: Only run on specific file changes - # paths: - # - "src/**/*.ts" - # - "src/**/*.tsx" - # - "src/**/*.js" - # - "src/**/*.jsx" + types: + - opened + - synchronize + - ready_for_review + - reopened + paths-ignore: + - "**/*.md" + - "docs/**" + +concurrency: + group: claude-code-review-${{ github.event.pull_request.number }} + cancel-in-progress: true jobs: claude-review: - # Optional: Filter by PR author - # if: | - # github.event.pull_request.user.login == 'external-contributor' || - # github.event.pull_request.user.login == 'new-developer' || - # github.event.pull_request.author_association == 'FIRST_TIME_CONTRIBUTOR' - + if: ${{ !github.event.pull_request.draft }} runs-on: ubuntu-latest + timeout-minutes: 20 permissions: contents: read - pull-requests: read - issues: read + pull-requests: write id-token: write steps: - name: Checkout repository - uses: actions/checkout@v4 + uses: actions/checkout@v6 with: fetch-depth: 1 @@ -36,9 +36,30 @@ jobs: uses: anthropics/claude-code-action@v1 with: claude_code_oauth_token: ${{ secrets.CLAUDE_CODE_OAUTH_TOKEN }} - plugin_marketplaces: 'https://github.com/anthropics/claude-code.git' - plugins: 'code-review@claude-code-plugins' - prompt: '/code-review:code-review ${{ github.repository }}/pull/${{ github.event.pull_request.number }}' - # See https://github.com/anthropics/claude-code-action/blob/main/docs/usage.md - # or https://code.claude.com/docs/en/cli-reference for available options + track_progress: true + prompt: | + REPO: ${{ github.repository }} + PR NUMBER: ${{ github.event.pull_request.number }} + + Review this pull request against the standards in AGENTS.md. + + Focus on: + - correctness and likely regressions + - missing validation, error handling, or authorization checks + - maintainability and consistency with the repository's house stack + - missing or weak tests for changed behavior + - performance or data-access problems introduced by the change + + Keep the review high signal: + - comment only when you find a concrete, actionable issue + - prefer inline comments for file-specific findings + - use mcp__github_inline_comment__create_inline_comment with confirmed: true for inline review comments + - use a single top-level comment only for cross-cutting concerns or when no actionable issues remain + - do not restate the PR description or praise unchanged code + - do not suggest new frameworks or parallel patterns that conflict with AGENTS.md + The PR branch is already checked out in the working directory. + Only post GitHub comments. Do not return the review as plain action output. + claude_args: | + --model claude-opus-4-6 + --allowedTools "mcp__github_inline_comment__create_inline_comment,Bash(gh pr comment:*),Bash(gh pr diff:*),Bash(gh pr view:*)" From 8c1ed73a972705b14d9fccf504b4a4107dd66eac Mon Sep 17 00:00:00 2001 From: David Diviny Date: Wed, 8 Apr 2026 08:42:51 +1000 Subject: [PATCH 2/3] Skip self-review when workflow changes --- .github/workflows/claude-code-review.yml | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/.github/workflows/claude-code-review.yml b/.github/workflows/claude-code-review.yml index f8d060e..11d8b23 100644 --- a/.github/workflows/claude-code-review.yml +++ b/.github/workflows/claude-code-review.yml @@ -31,7 +31,30 @@ jobs: with: fetch-depth: 1 + - name: Detect changes to this workflow + id: workflow-changes + uses: actions/github-script@v7 + with: + script: | + const files = await github.paginate(github.rest.pulls.listFiles, { + owner: context.repo.owner, + repo: context.repo.repo, + pull_number: context.payload.pull_request.number, + per_page: 100, + }) + + const workflowPath = '.github/workflows/claude-code-review.yml' + const changed = files.some((file) => file.filename === workflowPath) + + core.setOutput('self_changed', changed ? 'true' : 'false') + + - name: Skip self-review for workflow updates + if: steps.workflow-changes.outputs.self_changed == 'true' + run: | + echo "Skipping Claude Code Review because this PR modifies .github/workflows/claude-code-review.yml." + - name: Run Claude Code Review + if: steps.workflow-changes.outputs.self_changed != 'true' id: claude-review uses: anthropics/claude-code-action@v1 with: From 8ff016e29533294ce0acb964686c69a503a158d4 Mon Sep 17 00:00:00 2001 From: David Diviny Date: Wed, 8 Apr 2026 08:46:52 +1000 Subject: [PATCH 3/3] Improve Claude review context --- .github/workflows/claude-code-review.yml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/.github/workflows/claude-code-review.yml b/.github/workflows/claude-code-review.yml index 11d8b23..dc89328 100644 --- a/.github/workflows/claude-code-review.yml +++ b/.github/workflows/claude-code-review.yml @@ -7,6 +7,7 @@ on: - synchronize - ready_for_review - reopened + # Skip docs-only pull requests. PRs that also change code still run the review. paths-ignore: - "**/*.md" - "docs/**" @@ -48,7 +49,7 @@ jobs: core.setOutput('self_changed', changed ? 'true' : 'false') - - name: Skip self-review for workflow updates + - name: Log skipped self-review if: steps.workflow-changes.outputs.self_changed == 'true' run: | echo "Skipping Claude Code Review because this PR modifies .github/workflows/claude-code-review.yml." @@ -85,4 +86,4 @@ jobs: Only post GitHub comments. Do not return the review as plain action output. claude_args: | --model claude-opus-4-6 - --allowedTools "mcp__github_inline_comment__create_inline_comment,Bash(gh pr comment:*),Bash(gh pr diff:*),Bash(gh pr view:*)" + --allowedTools "Read,Glob,Grep,mcp__github_inline_comment__create_inline_comment,Bash(gh pr comment:*),Bash(gh pr diff:*),Bash(gh pr view:*)"