From f13bcf383fda63325ba85093fdac7a37daa38121 Mon Sep 17 00:00:00 2001 From: Mario Campos Date: Thu, 29 Oct 2026 10:20:21 -0500 Subject: [PATCH] Warn if more than one marked comment was found --- pr-checks/post-comment.ts | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/pr-checks/post-comment.ts b/pr-checks/post-comment.ts index 20dad0cf0..6c9542d29 100644 --- a/pr-checks/post-comment.ts +++ b/pr-checks/post-comment.ts @@ -75,7 +75,17 @@ export async function findExistingComment( issue_number: issueNumber, per_page: 100, }); - return comments.find((comment) => comment.body?.startsWith(marker))?.id; + const markedComments = comments.filter((comment) => + comment.body?.startsWith(marker), + ); + if (markedComments.length > 1) { + console.warn( + `Found ${markedComments.length} comments with marker "${marker}". ` + + "Updating the first one and leaving the others unchanged." + + "Use a unique marker for each distinct managed comment to avoid this situation.", + ); + } + return markedComments[0]?.id; } /**