@@ -221,9 +221,33 @@ jobs:
221
221
// Get the PR number from the event
222
222
const prNumber = ${{ github.event.pull_request.number }};
223
223
224
- github.rest.issues.createComment({
224
+ // Search for existing comments from our bot
225
+ const comments = await github.rest.issues.listComments({
225
226
issue_number: prNumber,
226
227
owner: context.repo.owner,
227
228
repo: context.repo.repo,
228
- body: `## LLM Analysis of PR Changes\n\n${analysis}`
229
- })
229
+ per_page: 100
230
+ });
231
+
232
+ // Find our bot's comment by looking for the specific header
233
+ const botComment = comments.data.find(comment =>
234
+ comment.body.startsWith('## LLM Analysis of PR Changes')
235
+ );
236
+
237
+ if (botComment) {
238
+ // Update existing comment
239
+ await github.rest.issues.updateComment({
240
+ comment_id: botComment.id,
241
+ owner: context.repo.owner,
242
+ repo: context.repo.repo,
243
+ body: `## LLM Analysis of PR Changes\n\n${analysis}`
244
+ });
245
+ } else {
246
+ // Create new comment if none exists
247
+ await github.rest.issues.createComment({
248
+ issue_number: prNumber,
249
+ owner: context.repo.owner,
250
+ repo: context.repo.repo,
251
+ body: `## LLM Analysis of PR Changes\n\n${analysis}`
252
+ });
253
+ }
0 commit comments