(pr: CleanupCandidate)
| 256 | } |
| 257 | |
| 258 | async function closePullRequest(pr: CleanupCandidate) { |
| 259 | await githubRequest(`/repos/${repo.owner}/${repo.name}/issues/${pr.number}/comments`, { |
| 260 | method: "POST", |
| 261 | body: JSON.stringify({ body: message }), |
| 262 | }) |
| 263 | await githubRequest(`/repos/${repo.owner}/${repo.name}/pulls/${pr.number}`, { |
| 264 | method: "PATCH", |
| 265 | body: JSON.stringify({ state: "closed" }), |
| 266 | }) |
| 267 | await githubRequest(`/repos/${repo.owner}/${repo.name}/issues/${pr.number}/labels`, { |
| 268 | method: "POST", |
| 269 | body: JSON.stringify({ labels: [cleanupLabel] }), |
| 270 | }) |
| 271 | console.log(`Closed #${pr.number} positive=${pr.positiveReactions} ${pr.url}`) |
| 272 | } |
| 273 | |
| 274 | async function ensureCleanupLabel() { |
| 275 | const response = await fetch( |
no test coverage detected