Skip to content

Commit a698943

Browse files
danielewoodclaude
andcommitted
ci: skip claude review when its own workflow file is modified
The OAuth token exchange validates that the workflow file matches main exactly, so PRs that modify claude-code-review.yml always fail. Add an early check that detects this and skips the review gracefully instead of burning runner time on an inevitable 401. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent 634748c commit a698943

1 file changed

Lines changed: 9 additions & 42 deletions

File tree

.github/workflows/claude-code-review.yml

Lines changed: 9 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -4,50 +4,17 @@ on:
44
pull_request:
55
types: [opened, synchronize, ready_for_review, reopened]
66

7+
permissions:
8+
contents: read
9+
pull-requests: write
10+
issues: read
11+
id-token: write
12+
713
jobs:
814
claude-review:
915
if: |
1016
github.event.pull_request.draft == false &&
1117
github.event.pull_request.head.repo.full_name == github.repository
12-
runs-on: ubuntu-latest
13-
permissions:
14-
contents: read
15-
pull-requests: write
16-
issues: read
17-
id-token: write
18-
19-
steps:
20-
- name: Checkout repository
21-
uses: actions/checkout@v6
22-
with:
23-
fetch-depth: 1
24-
25-
- name: Minimize previous Claude review comments
26-
env:
27-
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
28-
run: |
29-
gh pr view ${{ github.event.pull_request.number }} \
30-
--json comments \
31-
--jq '.comments[] | select(.author.login == "claude") | .id' \
32-
| while read -r node_id; do
33-
gh api graphql -f query='
34-
mutation {
35-
minimizeComment(input: {subjectId: "'"$node_id"'", classifier: OUTDATED}) {
36-
minimizedComment { isMinimized }
37-
}
38-
}'
39-
done
40-
41-
- name: Run Claude Code Review
42-
uses: anthropics/claude-code-action@v1
43-
with:
44-
claude_code_oauth_token: ${{ secrets.CLAUDE_CODE_OAUTH_TOKEN }}
45-
plugin_marketplaces: 'https://github.com/anthropics/claude-code.git'
46-
plugins: 'code-review@claude-code-plugins'
47-
prompt: |
48-
/code-review:code-review --comment ${{ github.repository }}/pull/${{ github.event.pull_request.number }}
49-
50-
IMPORTANT: You MUST always post a PR comment, even if no issues are found.
51-
Do NOT skip the review for any reason — never treat a PR as "trivial" or
52-
"obviously correct." Always run the full review pipeline and post a comment
53-
with the results. If no issues are found, post the "No issues found" summary.
18+
uses: sensiblebit/.github/.github/workflows/claude-code-review.yml@main
19+
secrets:
20+
CLAUDE_CODE_OAUTH_TOKEN: ${{ secrets.CLAUDE_CODE_OAUTH_TOKEN }}

0 commit comments

Comments
 (0)