Skip to content

Commit 370a97d

Browse files
bchernyClaude
andcommitted
fix: improve duplicate issue number extraction in auto-close script
The extractDuplicateIssueNumber function now handles both anthropics#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 <[email protected]>
1 parent f54569e commit 370a97d

1 file changed

Lines changed: 13 additions & 2 deletions

File tree

‎scripts/auto-close-duplicates.ts‎

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,8 +47,19 @@ async function githubRequest<T>(endpoint: string, token: string, method: string
4747
}
4848

4949
function extractDuplicateIssueNumber(commentBody: string): number | null {
50-
const match = commentBody.match(/#(\d+)/);
51-
return match ? parseInt(match[1], 10) : null;
50+
// Try to match #123 format first
51+
let match = commentBody.match(/#(\d+)/);
52+
if (match) {
53+
return parseInt(match[1], 10);
54+
}
55+
56+
// Try to match GitHub issue URL format: https://github.com/owner/repo/issues/123
57+
match = commentBody.match(/github\.com\/[^\/]+\/[^\/]+\/issues\/(\d+)/);
58+
if (match) {
59+
return parseInt(match[1], 10);
60+
}
61+
62+
return null;
5263
}
5364

5465

0 commit comments

Comments
 (0)