( token: string, owner: string, repo: string, issueNumber: number )
| 124 | } |
| 125 | |
| 126 | export async function closeIssue( |
| 127 | token: string, |
| 128 | owner: string, |
| 129 | repo: string, |
| 130 | issueNumber: number |
| 131 | ) { |
| 132 | const res = await ghFetch(`/repos/${owner}/${repo}/issues/${issueNumber}`, token, { |
| 133 | method: 'PATCH', |
| 134 | body: JSON.stringify({ state: 'closed' }), |
| 135 | headers: { 'Content-Type': 'application/json' }, |
| 136 | }); |
| 137 | |
| 138 | if (!res.ok) { |
| 139 | const err = await res.json().catch(() => ({ message: res.statusText })); |
| 140 | throw new Error(`Failed to close issue: ${err.message || `HTTP ${res.status}`}`); |
| 141 | } |
| 142 | return res.json(); |
| 143 | } |
| 144 | |
| 145 | // ── PR / Branch / Commit APIs ── |
| 146 |
no test coverage detected