fix: improve duplicate issue number extraction in auto-close script

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 <noreply@anthropic.com>
This commit is contained in:
Boris Cherny
2025-08-14 16:37:46 -07:00
parent f54569efd2
commit 370a97d939

View File

@@ -47,8 +47,19 @@ async function githubRequest<T>(endpoint: string, token: string, method: string
} }
function extractDuplicateIssueNumber(commentBody: string): number | null { function extractDuplicateIssueNumber(commentBody: string): number | null {
const match = commentBody.match(/#(\d+)/); // Try to match #123 format first
return match ? parseInt(match[1], 10) : null; 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;
} }