Skip to content

Commit 751f33a

Browse files
committed
chore(gh): make claude edit existing discussion comment for subsequent reviews
1 parent 5d5591a commit 751f33a

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

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

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,9 +49,14 @@ jobs:
4949
5050
Use the repository's CLAUDE.md for guidance on style and conventions. Be constructive and helpful in your feedback.
5151
52-
Use `gh pr comment` with your Bash tool to leave your review as a comment on the PR.
52+
To post your review:
53+
1. First, check if you've already commented on this PR by listing comments: `gh api repos/${{ github.repository }}/issues/${{ github.event.pull_request.number }}/comments --jq '.[] | select(.user.login == "github-actions[bot]") | {id: .id, created_at: .created_at}' | tail -1`
54+
2. If a comment exists (you get a comment ID), update it using: `gh api --method PATCH repos/${{ github.repository }}/issues/comments/COMMENT_ID -f body="YOUR_REVIEW_CONTENT"`
55+
3. If no comment exists, create a new one using: `gh pr comment ${{ github.event.pull_request.number }} --body "YOUR_REVIEW_CONTENT"`
56+
57+
This ensures you edit your previous review instead of creating duplicate comments on subsequent PR updates.
5358
5459
# See https://github.com/anthropics/claude-code-action/blob/main/docs/usage.md
5560
# or https://docs.claude.com/en/docs/claude-code/cli-reference for available options
56-
claude_args: '--allowed-tools "Bash(gh issue view:*),Bash(gh search:*),Bash(gh issue list:*),Bash(gh pr comment:*),Bash(gh pr diff:*),Bash(gh pr view:*),Bash(gh pr list:*)"'
61+
claude_args: '--allowed-tools "Bash(gh issue view:*),Bash(gh search:*),Bash(gh issue list:*),Bash(gh pr comment:*),Bash(gh pr diff:*),Bash(gh pr view:*),Bash(gh pr list:*),Bash(gh api:*)"'
5762

0 commit comments

Comments
 (0)