@@ -49,25 +49,21 @@ jobs:
49
49
git config --global user.name "Port Claude AI"
50
50
git config --global user.email "port-claude-ai@port.io"
51
51
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 != ''
53
62
env :
54
63
GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
55
64
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 }}"
71
67
72
68
- name : Run Claude PR Action
73
69
uses : anthropics/claude-code-action@beta
0 commit comments