diff --git a/.github/workflows/doc-review.yml b/.github/workflows/claude-pr-review.yml similarity index 61% rename from .github/workflows/doc-review.yml rename to .github/workflows/claude-pr-review.yml index b8a96bc..665b3f6 100644 --- a/.github/workflows/doc-review.yml +++ b/.github/workflows/claude-pr-review.yml @@ -12,9 +12,6 @@ on: - 'config/navigation.json' - 'docs.json' -# Cancel any in-flight review when a new commit is pushed to the PR. The -# sticky comment then reflects only the latest PR head, not intermediate -# states. concurrency: group: doc-review-${{ github.event.pull_request.number }} cancel-in-progress: true @@ -38,7 +35,8 @@ jobs: with: fetch-depth: 0 - - name: Run Claude doc review + - name: Run Claude doc review (general) + if: github.event.action != 'synchronize' uses: anthropics/claude-code-action@cfc3eb22bfed5c26ef66e3223c982af27e4524de # v1.0.231 env: GH_TOKEN: ${{ github.token }} @@ -55,9 +53,10 @@ jobs: # --allowedTools is a whitelist - the agent can ONLY use these tools # plus the implicit Read/Grep/Glob set. Bash is scoped to the minimum # gh subcommands needed to read PR context and post comments. - claude_args: | - --max-turns 30 - --model claude-opus-5 + claude_args: >- + --max-turns 40 + --max-budget-usd 5 + --model claude-opus-5-5 --allowedTools "mcp__github_inline_comment__create_inline_comment,Bash(gh pr comment:*),Bash(gh pr diff:*),Bash(gh pr view:*)" prompt: | REPO: ${{ github.repository }} @@ -115,3 +114,51 @@ jobs: Use `mcp__github_inline_comment__create_inline_comment` to highlight specific issues on individual lines. Only post GitHub comments - don't submit review text as messages. + + - name: Run Claude doc review (new commits only) + if: github.event.action == 'synchronize' + uses: anthropics/claude-code-action@cfc3eb22bfed5c26ef66e3223c982af27e4524de # v1.0.231 + env: + GH_TOKEN: ${{ github.token }} + with: + allowed_bots: "mintlify,github-actions" + anthropic_federation_rule_id: ${{ vars.ANTHROPIC_FEDERATION_RULE_ID }} + anthropic_organization_id: ${{ vars.ANTHROPIC_ORGANIZATION_ID }} + anthropic_service_account_id: ${{ vars.ANTHROPIC_SERVICE_ACCOUNT_ID }} + track_progress: true + use_sticky_comment: true + # The `doc-review` skill is defined locally in + # `.claude/skills/doc-review/SKILL.md` and is picked up automatically + # from the checked-out repo. + # --allowedTools is a whitelist - the agent can ONLY use these tools + # plus the implicit Read/Grep/Glob set. Bash is scoped to the minimum + # gh subcommands needed to read PR context and post comments. + claude_args: >- + --max-turns 40 + --max-budget-usd 5 + --model claude-sonnet-5 + --allowedTools "mcp__github_inline_comment__create_inline_comment,Bash(gh pr comment:*),Bash(gh pr diff:*),Bash(gh pr view:*)" + prompt: | + You are following up on an existing review of PR #${{ github.event.pull_request.number }} + in ${{ github.repository }}. New commits were pushed: + BEFORE=${{ github.event.before }} AFTER=${{ github.event.after }} + + Scope rules — follow these strictly: + - Review ONLY the lines changed in `git diff BEFORE..AFTER`. If BEFORE is not + reachable (force-push), fall back to `gh pr diff` but still only examine hunks + touched by the newest commits (`git log --oneline -n 20`). + - Do NOT re-review unchanged code and do NOT look for new issues in files or + regions these commits did not touch. + + Steps: + 1. Fetch the existing review comments on this PR (gh api repos/${{ github.repository }}/pulls/${{ github.event.pull_request.number }}/comments + and gh pr view --comments). Collect every finding previously raised by Claude. + 2. For each previous finding whose location is touched by the new commits, decide: + resolved / partially addressed / not addressed. Do not repeat the original finding + text — just state the status and, if still open, one sentence on what's missing. Close resolved opened in-line comments! + 3. Within the changed lines only, flag anything that would be a bug, security issue, + or a regression introduced by the fix itself. Post these as inline comments. + Skip style nits and anything that is a matter of preference. + 4. Post ONE summary comment via `gh pr comment` listing the status of each previous + finding you evaluated and the count of any new inline comments. If every touched + finding is resolved and nothing new was found, say so in a single line.