mirror of
https://github.com/anthropics/claude-code.git
synced 2026-02-19 04:27:33 -08:00
Fix sweep script crashing on locked issues
The sweep job (https://github.com/anthropics/claude-code/actions/runs/21983111029/job/63510453226) was silently failing when closeExpired tried to comment on a locked issue, causing a 403 from the GitHub API. Two issues: 1. closeExpired didn't skip locked issues like markStale already does. Adding the same `if (issue.locked) continue` guard fixes this. 2. The error was swallowed by `main().catch(console.error)` which logs to stderr but exits 0, so CI reported success despite the crash. Replaced the main() wrapper with top-level await so unhandled errors properly crash the process with a non-zero exit code. ## Test plan YOLO
This commit is contained in:
@@ -115,6 +115,7 @@ async function closeExpired(owner: string, repo: string) {
|
|||||||
|
|
||||||
for (const issue of issues) {
|
for (const issue of issues) {
|
||||||
if (issue.pull_request) continue;
|
if (issue.pull_request) continue;
|
||||||
|
if (issue.locked) continue;
|
||||||
const base = `/repos/${owner}/${repo}/issues/${issue.number}`;
|
const base = `/repos/${owner}/${repo}/issues/${issue.number}`;
|
||||||
|
|
||||||
const events = await githubRequest<any[]>(`${base}/events?per_page=100`);
|
const events = await githubRequest<any[]>(`${base}/events?per_page=100`);
|
||||||
@@ -144,20 +145,14 @@ async function closeExpired(owner: string, repo: string) {
|
|||||||
|
|
||||||
// --
|
// --
|
||||||
|
|
||||||
async function main() {
|
const owner = process.env.GITHUB_REPOSITORY_OWNER;
|
||||||
const owner = process.env.GITHUB_REPOSITORY_OWNER;
|
const repo = process.env.GITHUB_REPOSITORY_NAME;
|
||||||
const repo = process.env.GITHUB_REPOSITORY_NAME;
|
if (!owner || !repo)
|
||||||
if (!owner || !repo)
|
throw new Error("GITHUB_REPOSITORY_OWNER and GITHUB_REPOSITORY_NAME required");
|
||||||
throw new Error("GITHUB_REPOSITORY_OWNER and GITHUB_REPOSITORY_NAME required");
|
|
||||||
|
|
||||||
if (DRY_RUN) console.log("DRY RUN — no changes will be made\n");
|
if (DRY_RUN) console.log("DRY RUN — no changes will be made\n");
|
||||||
|
|
||||||
const labeled = await markStale(owner, repo);
|
const labeled = await markStale(owner, repo);
|
||||||
const closed = await closeExpired(owner, repo);
|
const closed = await closeExpired(owner, repo);
|
||||||
|
|
||||||
console.log(`\nDone: ${labeled} ${DRY_RUN ? "would be labeled" : "labeled"} stale, ${closed} ${DRY_RUN ? "would be closed" : "closed"}`);
|
console.log(`\nDone: ${labeled} ${DRY_RUN ? "would be labeled" : "labeled"} stale, ${closed} ${DRY_RUN ? "would be closed" : "closed"}`);
|
||||||
}
|
|
||||||
|
|
||||||
main().catch(console.error);
|
|
||||||
|
|
||||||
export {};
|
|
||||||
|
|||||||
Reference in New Issue
Block a user