( owner: string, repo: string, issueNumber: number, duplicateOfNumber: number, token: string )
| 64 | |
| 65 | |
| 66 | async function closeIssueAsDuplicate( |
| 67 | owner: string, |
| 68 | repo: string, |
| 69 | issueNumber: number, |
| 70 | duplicateOfNumber: number, |
| 71 | token: string |
| 72 | ): Promise<void> { |
| 73 | await githubRequest( |
| 74 | `/repos/${owner}/${repo}/issues/${issueNumber}`, |
| 75 | token, |
| 76 | 'PATCH', |
| 77 | { |
| 78 | state: 'closed', |
| 79 | state_reason: 'duplicate', |
| 80 | labels: ['duplicate'] |
| 81 | } |
| 82 | ); |
| 83 | |
| 84 | await githubRequest( |
| 85 | `/repos/${owner}/${repo}/issues/${issueNumber}/comments`, |
| 86 | token, |
| 87 | 'POST', |
| 88 | { |
| 89 | body: `This issue has been automatically closed as a duplicate of #${duplicateOfNumber}. |
| 90 | |
| 91 | If this is incorrect, please re-open this issue or create a new one. |
| 92 | |
| 93 | 🤖 Generated with [Claude Code](https://claude.ai/code)` |
| 94 | } |
| 95 | ); |
| 96 | |
| 97 | } |
| 98 | |
| 99 | async function autoCloseDuplicates(): Promise<void> { |
| 100 | console.log("[DEBUG] Starting auto-close duplicates script"); |
no test coverage detected