Skip to content

Commit 6a232f5

Browse files
committed
fix: detect and close duplicate issues from concurrent publishes
When two concurrent publish runs both observe no open issue, each creates its own. After creating, re-check openIssue() for a lower-numbered canonical issue. If one exists, close the duplicate and retry so the next iteration merges into the winner.
1 parent 5de21f9 commit 6a232f5

1 file changed

Lines changed: 9 additions & 0 deletions

File tree

‎benchmarks/size-review.mjs‎

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -305,6 +305,15 @@ function publish(directory) {
305305
bodyFile,
306306
]).trim();
307307
number = Number(url.split('/').pop());
308+
// A concurrent publish may also have created an issue. The canonical
309+
// issue is the lowest-numbered open one; close ours if it lost the race
310+
// and retry so the next iteration merges into the winner.
311+
const canonical = openIssue(repository);
312+
if (canonical && canonical.number < number) {
313+
run('gh', ['issue', 'close', String(number), '-R', repository]);
314+
console.warn(`closed duplicate #${number}; canonical issue is #${canonical.number}`);
315+
continue;
316+
}
308317
} else {
309318
run('gh', ['issue', 'edit', String(number), '-R', repository, '--body-file', bodyFile]);
310319
}

0 commit comments

Comments
 (0)