Skip to content

Commit 31ea88a

Browse files
don-petryclaude
andcommitted
fix(claude-fix-review-comments): add allowedTools, fix pagination, guard empty commit
- Add claude_args with --allowedTools covering gh pr checkout, gh pr view, gh pr comment, gh pr checks, gh run view/list/watch, gh api, git operations, Edit, and Write — required for every command the prompt issues; without this Claude refuses all Bash tool calls and the automation silently fails. - Bump reviewThreads(first:100) → first:250 (GraphQL max) so threads beyond 100 are not silently dropped on large PRs. - Guard the commit with git diff --cached --quiet to avoid a non-zero exit when there are no staged changes (all threads needed human input); configure git identity beforehand so commits don't fail on unconfigured runners. Co-Authored-By: Claude Sonnet 4.6 (1M context) <noreply@anthropic.com>
1 parent ef225ac commit 31ea88a

1 file changed

Lines changed: 9 additions & 2 deletions

File tree

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

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,10 @@ jobs:
8181
claude_code_oauth_token: ${{ secrets.CLAUDE_CODE_OAUTH_TOKEN }}
8282
github_token: ${{ secrets.GH_PAT_WORKFLOWS || github.token }}
8383
# yamllint disable rule:line-length
84+
claude_args: |
85+
--allowedTools "Bash(gh pr checkout:*),Bash(gh pr view:*),Bash(gh pr comment:*),Bash(gh pr checks:*),Bash(gh run view:*),Bash(gh run list:*),Bash(gh run watch:*),Bash(gh api:*),Bash(git*:*),Edit,Write"
86+
# yamllint enable rule:line-length
87+
# yamllint disable rule:line-length
8488
prompt: |
8589
A reviewer has left a comment on PR #${{ github.event.pull_request.number }} (${{ github.event.pull_request.html_url }}).
8690
@@ -99,7 +103,7 @@ jobs:
99103
100104
### 2. Fetch all open review threads (collect node IDs — you need them to resolve threads later)
101105
```
102-
gh api graphql -f query='query { repository(owner:"${{ github.repository_owner }}", name:"${{ github.event.repository.name }}") { pullRequest(number:${{ github.event.pull_request.number }}) { reviewThreads(first:100) { nodes { id isResolved comments(first:10) { nodes { path line body author { login } } } } } } } }'
106+
gh api graphql -f query='query { repository(owner:"${{ github.repository_owner }}", name:"${{ github.event.repository.name }}") { pullRequest(number:${{ github.event.pull_request.number }}) { reviewThreads(first:250) { nodes { id isResolved comments(first:10) { nodes { path line body author { login } } } } } } } }'
103107
```
104108
105109
### 3. Address each unresolved thread
@@ -110,10 +114,13 @@ jobs:
110114
111115
### 4. Commit and push all fixes in one commit
112116
```
117+
git config user.name "claude[bot]"
118+
git config user.email "claude[bot]@users.noreply.github.com"
113119
git add -A
114-
git commit -m "fix: address review comments"
120+
git diff --cached --quiet || git commit -m "fix: address review comments"
115121
git push
116122
```
123+
If there are no staged changes (all open threads needed human input), skip the commit and push.
117124
118125
### 5. Resolve each thread you addressed via GraphQL (use the node IDs from step 2)
119126
```

0 commit comments

Comments
 (0)