Skip to content

Commit c0da7ca

Browse files
authored
Refactor Claude Code Review workflow (#1257)
1 parent b528867 commit c0da7ca

File tree

1 file changed

+11
-24
lines changed

1 file changed

+11
-24
lines changed

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

Lines changed: 11 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -20,25 +20,7 @@ jobs:
2020
with:
2121
ref: ${{ github.event.pull_request.head.sha }}
2222
fetch-depth: 1
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-
23+
4224
- name: Run Claude Code Review
4325
id: claude-review
4426
uses: anthropics/claude-code-action@v1
@@ -50,22 +32,26 @@ jobs:
5032
plugins: 'code-review@claude-code-plugins'
5133

5234
claude_args: >
35+
--dangerouslyDisableSandbox
36+
--max-turns 10
5337
--allowedTools
5438
"Bash(gh pr view:*)"
5539
"Bash(gh pr diff:*)"
5640
"Bash(gh pr comment:*)"
57-
"Bash(gh api:*)"
58-
"Bash(gh search code:*)"
41+
"Bash(gh api repos/*/pulls/*:*)"
42+
"Bash(gh api repos/*/issues/*/comments:*)"
5943
"Bash(cat:*)"
6044
"Bash(ls:*)"
6145
"Bash(grep:*)"
62-
"Bash(python3:*)"
63-
"Bash(git:*)"
46+
"Bash(find:*)"
6447
6548
prompt: |
6649
/code-review:code-review ${{ github.repository }}/pull/${{ github.event.pull_request.number }}
6750
68-
Post the results as ONE top-level PR comment titled "Claude Code Review".
51+
Always use the numeric PR form with --repo, e.g.:
52+
- gh pr view ${{ github.event.pull_request.number }} --repo ${{ github.repository }} ...
53+
- gh pr diff ${{ github.event.pull_request.number }} --repo ${{ github.repository }} ...
54+
- gh pr comment ${{ github.event.pull_request.number }} --repo ${{ github.repository }} ...
6955
7056
Output requirements (even if no issues):
7157
- Start with: files changed count + list up to 15 changed file paths
@@ -74,6 +60,7 @@ jobs:
7460
- If issues: list them with file path + line numbers when possible
7561
- If no issues: list at least 3 concrete "improvement opportunities" with file paths
7662
63+
Post the results as ONE top-level PR comment titled "Claude Code Review".
7764
If you cannot access the diff/files, say exactly what is blocked.
7865
If posting a PR comment is blocked, write the full review to the GitHub Actions job summary instead.
7966

0 commit comments

Comments
 (0)