Skip to content

Commit f13bcf3

Browse files
committed
Warn if more than one marked comment was found
1 parent 5bb3554 commit f13bcf3

1 file changed

Lines changed: 11 additions & 1 deletion

File tree

‎pr-checks/post-comment.ts‎

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,17 @@ export async function findExistingComment(
7575
issue_number: issueNumber,
7676
per_page: 100,
7777
});
78-
return comments.find((comment) => comment.body?.startsWith(marker))?.id;
78+
const markedComments = comments.filter((comment) =>
79+
comment.body?.startsWith(marker),
80+
);
81+
if (markedComments.length > 1) {
82+
console.warn(
83+
`Found ${markedComments.length} comments with marker "${marker}". ` +
84+
"Updating the first one and leaving the others unchanged." +
85+
"Use a unique marker for each distinct managed comment to avoid this situation.",
86+
);
87+
}
88+
return markedComments[0]?.id;
7989
}
8090

8191
/**

0 commit comments

Comments
 (0)