|
6 | 6 |
|
7 | 7 | const fs = require('fs'); |
8 | 8 | const { spawnSync } = require('child_process'); |
| 9 | +const REVIEW_MARKER = '<!-- nutrient-code-review-action -->'; |
9 | 10 |
|
10 | 11 | // PR Summary marker for identifying our summary sections |
11 | 12 | const PR_SUMMARY_MARKER = '📋 **PR Summary:**'; |
@@ -102,6 +103,7 @@ function addReactionsToReview(reviewId) { |
102 | 103 | // Check if a review was posted by this action |
103 | 104 | function isOwnReview(review) { |
104 | 105 | if (!review.body) return false; |
| 106 | + if (review.body.includes(REVIEW_MARKER)) return true; |
105 | 107 |
|
106 | 108 | // Check for our review summary patterns |
107 | 109 | const ownPatterns = [ |
@@ -135,8 +137,8 @@ function findExistingReview() { |
135 | 137 |
|
136 | 138 | for (const review of reviews) { |
137 | 139 | const isDismissible = review.state === 'APPROVED' || review.state === 'CHANGES_REQUESTED'; |
138 | | - const isBot = review.user && review.user.type === 'Bot'; |
139 | 140 | const isOwn = isOwnReview(review); |
| 141 | + const isBot = review.user && review.user.type === 'Bot'; |
140 | 142 |
|
141 | 143 | if (isBot && isDismissible && isOwn) { |
142 | 144 | return review; |
@@ -293,7 +295,7 @@ async function run() { |
293 | 295 |
|
294 | 296 | const highSeverityCount = analysisSummary.high_severity || 0; |
295 | 297 | const reviewEvent = highSeverityCount > 0 ? 'REQUEST_CHANGES' : 'APPROVE'; |
296 | | - const reviewBody = buildReviewSummary(newFindings, prSummary, analysisSummary); |
| 298 | + const reviewBody = `${buildReviewSummary(newFindings, prSummary, analysisSummary)}\n\n${REVIEW_MARKER}`; |
297 | 299 |
|
298 | 300 | // Prepare review comments |
299 | 301 | const reviewComments = []; |
|
0 commit comments