MCPcopy Create free account
hub / github.com/anomalyco/opencode / close

Function close

script/github/close-issues.ts:42–60  ·  view source on GitHub ↗
(num: number)

Source from the content-addressed store, hash-verified

40}
41
42async function close(num: number) {
43 const base = `https://api.github.com/repos/${repo}/issues/${num}`
44
45 const comment = await fetch(`${base}/comments`, {
46 method: "POST",
47 headers,
48 body: JSON.stringify({ body: msg }),
49 })
50 if (!comment.ok) throw new Error(`Failed to comment #${num}: ${comment.status} ${comment.statusText}`)
51
52 const patch = await fetch(base, {
53 method: "PATCH",
54 headers,
55 body: JSON.stringify({ state: "closed", state_reason: "not_planned" }),
56 })
57 if (!patch.ok) throw new Error(`Failed to close #${num}: ${patch.status} ${patch.statusText}`)
58
59 console.log(`Closed https://github.com/${repo}/issues/${num}`)
60}
61
62async function main() {
63 let page = 1

Callers 1

mainFunction · 0.70

Calls 2

fetchFunction · 0.50
logMethod · 0.45

Tested by

no test coverage detected