From 0bc39f9ffcd97a96f3d60d5ca93175c16fd20342 Mon Sep 17 00:00:00 2001 From: Mario Campos Date: Fri, 30 Oct 2026 09:35:55 -0500 Subject: [PATCH] Prefer last comment when there are multiple to choose from --- pr-checks/post-comment.test.ts | 2 +- pr-checks/post-comment.ts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/pr-checks/post-comment.test.ts b/pr-checks/post-comment.test.ts index 63e0f6caa..8bef06104 100644 --- a/pr-checks/post-comment.test.ts +++ b/pr-checks/post-comment.test.ts @@ -193,7 +193,7 @@ describe("findExistingComment", async () => { 1, "marker", ); - assert.equal(id, 2); + assert.equal(id, 3); }); await it("returns undefined when no comment matches", async () => { diff --git a/pr-checks/post-comment.ts b/pr-checks/post-comment.ts index b9081c5a1..cb8debaa9 100644 --- a/pr-checks/post-comment.ts +++ b/pr-checks/post-comment.ts @@ -112,7 +112,7 @@ export async function findExistingComment( "Use a unique marker for each distinct managed comment to avoid this situation.", ); } - return markedComments[0]?.id; + return markedComments.at(-1)?.id; } /**