@@ -20,25 +20,71 @@ jobs:
2020 with :
2121 ref : ${{ github.event.pull_request.head.sha }}
2222 fetch-depth : 1
23-
23+
24+ - name : Remove prior Claude review comment (so review runs again)
25+ env :
26+ GH_TOKEN : ${{ github.token }}
27+ run : |
28+ pr=${{ github.event.pull_request.number }}
29+ repo=${{ github.repository }}
30+
31+ # Find first issue comment whose body starts with "## Claude Code Review"
32+ comment_id=$(gh api repos/$repo/issues/$pr/comments \
33+ --jq '.[] | select(.body | startswith("## Claude Code Review")) | .id' | head -n 1)
34+
35+ if [ -n "$comment_id" ]; then
36+ echo "Deleting prior Claude review comment id=$comment_id"
37+ gh api -X DELETE repos/$repo/issues/comments/$comment_id
38+ else
39+ echo "No prior Claude review comment found."
40+ fi
41+
2442 - name : Run Claude Code Review
2543 id : claude-review
2644 uses : anthropics/claude-code-action@v1
2745 with :
2846 claude_code_oauth_token : ${{ secrets.CLAUDE_CODE_OAUTH_TOKEN }}
2947 github_token : ${{ github.token }}
3048
31- show_full_output : true
32-
3349 plugin_marketplaces : ' https://github.com/anthropics/claude-code.git'
3450 plugins : ' code-review@claude-code-plugins'
3551
36- claude_args : |
37- --allowedTools "Bash(*)"
52+ claude_args : >
53+ --allowedTools
54+ "Bash(gh pr view:*)"
55+ "Bash(gh pr diff:*)"
56+ "Bash(gh pr comment:*)"
57+ "Bash(gh api:*)"
58+ "Bash(gh search code:*)"
59+ "Bash(cat:*)"
60+ "Bash(ls:*)"
61+ "Bash(grep:*)"
62+ "Bash(python3:*)"
63+ "Bash(git:*)"
3864
3965 prompt : |
4066 /code-review:code-review ${{ github.repository }}/pull/${{ github.event.pull_request.number }}
41- Post the results as one top-level PR comment titled "Claude Code Review".
67+
68+ Post the results as ONE top-level PR comment titled "Claude Code Review".
69+
70+ Output requirements (even if no issues):
71+ - Start with: files changed count + list up to 15 changed file paths
72+ - Then: a short summary of what the PR changes (3–6 bullets)
73+ - Then: findings:
74+ - If issues: list them with file path + line numbers when possible
75+ - If no issues: list at least 3 concrete "improvement opportunities" with file paths
76+
77+ If you cannot access the diff/files, say exactly what is blocked.
78+ If posting a PR comment is blocked, write the full review to the GitHub Actions job summary instead.
79+
80+ IMPORTANT:
81+ - Do NOT stop just because a previous "Claude Code Review" comment exists.
82+ - If a prior Claude review exists, post a NEW comment titled "Claude Code Review (updated)" that includes:
83+ - current head SHA: ${{ github.event.pull_request.head.sha }}
84+ - files changed count + up to 15 file paths
85+ - 3–6 bullet summary of changes
86+ - findings or at least 3 improvement opportunities with file paths
87+ Post as ONE top-level PR comment.
4288
4389 additional_permissions : |
4490 actions: read
0 commit comments