Replies: 4 comments 3 replies
|
|
|
Sorry to kind of hijack the topic. I was also annoyed by this. |
|
I'm using something like this in my workflow: # Find existing Claude review comment to update instead of creating new ones
- name: Find existing Claude review
uses: peter-evans/find-comment@v4
id: find_claude_comment
with:
issue-number: ${{ github.event.pull_request.number }}
body-includes: '<!-- claude-code-review -->'
- name: Run Claude Code Review
id: claude-review
uses: anthropics/claude-code-action@v1
...
prompt: |
REPO: ${{ github.repository }}
PR NUMBER: ${{ github.event.pull_request.number }}
...
CRITICAL OUTPUT REQUIREMENTS:
1. Return a JSON object with a "review" field containing your complete markdown review
2. The review markdown must start with EXACTLY this line (including the HTML comment):
<!-- claude-code-review -->
## PR Review
3. The HTML comment is required for the workflow to identify and update this comment
4. Example output format:
{
"review": "<!-- claude-code-review -->\n## PR Review\n\n### Summary\n..."
}
claude_args: |
--allowed-tools "Read,Bash(gh pr diff:*),Bash(gh pr view:*),Bash(gh issue view:*),Bash(gh search:*),Bash(gh issue list:*),Bash(gh pr list:*)"
--json-schema '{"type":"object","properties":{"review":{"type":"string","description":"Complete markdown review starting with <!-- claude-code-review --> comment"}},"required":["review"]}'
# Create or update the review comment (single comment that gets updated on each run)
- name: Post or update Claude review
uses: peter-evans/create-or-update-comment@v5
with:
comment-id: ${{ steps.find_claude_comment.outputs.comment-id }}
issue-number: ${{ github.event.pull_request.number }}
body: ${{ fromJSON(steps.claude-review.outputs.structured_output).review }}
edit-mode: replace |
|
the action has a built-in - uses: anthropics/claude-code-action@v1
with:
use_sticky_comment: truecaveat from the docs: |
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
So every time I push a commit to a PR, Claude Code github action adds a whole brand new pr comment to it instead of modifying the previous comment. Is there any way I can change this behavior so that it would modify the comment instead of adding a new one every time? Currently this results in tons of Claude Code pr comments where the old ones are just completely useless.
All reactions