From 370a97d9397ef9e4e4f56741c0514b95002d1a7f Mon Sep 17 00:00:00 2001 From: Boris Cherny Date: Thu, 14 Aug 2025 16:37:46 -0700 Subject: [PATCH] fix: improve duplicate issue number extraction in auto-close script MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The extractDuplicateIssueNumber function now handles both #123 format and full GitHub issue URLs like https://github.com/owner/repo/issues/123. This fixes the "could not extract duplicate issue number from comment" errors that were occurring when the script encountered URL-formatted issue references in duplicate detection comments. 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude --- scripts/auto-close-duplicates.ts | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/scripts/auto-close-duplicates.ts b/scripts/auto-close-duplicates.ts index 0cee40a0..2ad3bd31 100644 --- a/scripts/auto-close-duplicates.ts +++ b/scripts/auto-close-duplicates.ts @@ -47,8 +47,19 @@ async function githubRequest(endpoint: string, token: string, method: string } function extractDuplicateIssueNumber(commentBody: string): number | null { - const match = commentBody.match(/#(\d+)/); - return match ? parseInt(match[1], 10) : null; + // Try to match #123 format first + let match = commentBody.match(/#(\d+)/); + if (match) { + return parseInt(match[1], 10); + } + + // Try to match GitHub issue URL format: https://github.com/owner/repo/issues/123 + match = commentBody.match(/github\.com\/[^\/]+\/[^\/]+\/issues\/(\d+)/); + if (match) { + return parseInt(match[1], 10); + } + + return null; }