(input: { query: string; variables: Record<string, string | null> })
| 244 | } |
| 245 | |
| 246 | async function graphql(input: { query: string; variables: Record<string, string | null> }) { |
| 247 | const response = await githubRequest("/graphql", { |
| 248 | method: "POST", |
| 249 | body: JSON.stringify(input), |
| 250 | }) |
| 251 | const body = (await response.json()) as GraphqlResponse |
| 252 | if (body.errors?.length) |
| 253 | throw new Error(`GitHub GraphQL error: ${body.errors.map((error) => error.message).join(", ")}`) |
| 254 | if (!body.data) throw new Error("GitHub GraphQL response did not include data") |
| 255 | return body.data |
| 256 | } |
| 257 | |
| 258 | async function closePullRequest(pr: CleanupCandidate) { |
| 259 | await githubRequest(`/repos/${repo.owner}/${repo.name}/issues/${pr.number}/comments`, { |
no test coverage detected