-
Notifications
You must be signed in to change notification settings - Fork 133
Add step to delete previous Claude review comments #1253
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -20,7 +20,25 @@ jobs: | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| with: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| ref: ${{ github.event.pull_request.head.sha }} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| fetch-depth: 1 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| - name: Remove prior Claude review comment (so review runs again) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| env: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| GH_TOKEN: ${{ github.token }} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| run: | | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| pr=${{ github.event.pull_request.number }} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| repo=${{ github.repository }} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| # Find first issue comment whose body starts with "## Claude Code Review" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| comment_id=$(gh api repos/$repo/issues/$pr/comments \ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| --jq '.[] | select(.body | startswith("## Claude Code Review")) | .id' | head -n 1) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| if [ -n "$comment_id" ]; then | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| echo "Deleting prior Claude review comment id=$comment_id" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| gh api -X DELETE repos/$repo/issues/comments/$comment_id | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Comment on lines
+24
to
+37
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| - name: Remove prior Claude review comment (so review runs again) | |
| env: | |
| GH_TOKEN: ${{ github.token }} | |
| run: | | |
| pr=${{ github.event.pull_request.number }} | |
| repo=${{ github.repository }} | |
| # Find first issue comment whose body starts with "## Claude Code Review" | |
| comment_id=$(gh api repos/$repo/issues/$pr/comments \ | |
| --jq '.[] | select(.body | startswith("## Claude Code Review")) | .id' | head -n 1) | |
| if [ -n "$comment_id" ]; then | |
| echo "Deleting prior Claude review comment id=$comment_id" | |
| gh api -X DELETE repos/$repo/issues/comments/$comment_id | |
| - name: Remove prior Claude review comments (so review runs again) | |
| env: | |
| GH_TOKEN: ${{ github.token }} | |
| run: | | |
| pr=${{ github.event.pull_request.number }} | |
| repo=${{ github.repository }} | |
| # Find all issue comments whose body starts with "## Claude Code Review" | |
| comment_ids=$(gh api repos/$repo/issues/$pr/comments \ | |
| --jq '.[] | select(.body | startswith("## Claude Code Review")) | .id') | |
| if [ -n "$comment_ids" ]; then | |
| echo "Deleting prior Claude review comments:" | |
| echo "$comment_ids" | while read -r comment_id; do | |
| if [ -n "$comment_id" ]; then | |
| echo " - Deleting comment id=$comment_id" | |
| gh api -X DELETE repos/$repo/issues/comments/$comment_id | |
| fi | |
| done |
Copilot
AI
Feb 23, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
GitHub PR issue comments don’t support a separate 'title' field—only the body text. If you need a 'title', instruct Claude to include a first-line markdown heading (e.g., ## Claude Code Review (updated)) or a consistent prefix in the comment body, rather than referring to the comment as being 'titled'.
Copilot
AI
Feb 23, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
GitHub PR issue comments don’t support a separate 'title' field—only the body text. If you need a 'title', instruct Claude to include a first-line markdown heading (e.g., ## Claude Code Review (updated)) or a consistent prefix in the comment body, rather than referring to the comment as being 'titled'.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The GitHub API response order for issue comments isn’t guaranteed to be the one you intend, so
head -n 1can delete an arbitrary matching comment. If the goal is to delete the latest/previous Claude comment, filter + sort by.created_at(or.updated_at) and then select the newest ID deterministically.