Skip to content

Commit 6fe6235

Browse files
authored
Merge pull request #2655 from port-labs/claude-fix
fix logic
2 parents f2ddd7f + 227b624 commit 6fe6235

File tree

1 file changed

+12
-16
lines changed

1 file changed

+12
-16
lines changed

.github/workflows/claude-pr-reviewer.yml

Lines changed: 12 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -49,25 +49,21 @@ jobs:
4949
git config --global user.name "Port Claude AI"
5050
git config --global user.email "port-claude-ai@port.io"
5151
52-
- name: Delete Previous Claude Comments
52+
- name: Find Last Claude Comment
53+
uses: peter-evans/find-comment@v3
54+
id: find-comment
55+
with:
56+
issue-number: ${{ github.event.pull_request.number }}
57+
comment-author: 'claude'
58+
direction: last
59+
60+
- name: Delete Last Claude Comment
61+
if: steps.find-comment.outputs.comment-id != ''
5362
env:
5463
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
5564
run: |
56-
# Get all comments on this PR made by claude bot
57-
echo "Looking for previous Claude review comments to delete..."
58-
comment_ids=$(gh api repos/${{ github.repository }}/issues/${{ github.event.pull_request.number }}/comments \
59-
--jq '.[] | select(.user.login == "claude") | .id')
60-
61-
if [ ! -z "$comment_ids" ]; then
62-
echo "$comment_ids" | while read comment_id; do
63-
if [ ! -z "$comment_id" ]; then
64-
echo "Deleting previous Claude comment ID: $comment_id"
65-
gh api repos/${{ github.repository }}/issues/comments/$comment_id -X DELETE || echo "Failed to delete comment $comment_id"
66-
fi
67-
done
68-
else
69-
echo "No previous Claude comments found to delete"
70-
fi
65+
gh api repos/${{ github.repository }}/issues/comments/${{ steps.find-comment.outputs.comment-id }} -X DELETE
66+
echo "Deleted last Claude comment ID: ${{ steps.find-comment.outputs.comment-id }}"
7167
7268
- name: Run Claude PR Action
7369
uses: anthropics/claude-code-action@beta

0 commit comments

Comments
 (0)