surshar / claude-code
Claude Code is an agentic coding tool that lives in your terminal, understands your codebase, and helps you code faster by executing routine tasks, explaining complex code, and handling git workflows - all through natural language commands.
Built by Anthropic · github.com/anthropics
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
| @@ -115,6 +115,7 @@ | ||
| 115 | 115 | |
| 116 | 116 | for (const issue of issues) { |
| 117 | 117 | if (issue.pull_request) continue; |
| 118 | + if (issue.locked) continue; | |
| 118 | 119 | const base = `/repos/${owner}/${repo}/issues/${issue.number}`; |
| 119 | 120 | |
| 120 | 121 | const events = await githubRequest<any[]>(`${base}/events?per_page=100`); |
| @@ -144,20 +145,14 @@ | ||
| 144 | 145 | |
| 145 | 146 | // -- |
| 146 | 147 | |
| 147 | -async function main() { | |
| 148 | - const owner = process.env.GITHUB_REPOSITORY_OWNER; | |
| 149 | - const repo = process.env.GITHUB_REPOSITORY_NAME; | |
| 150 | - if (!owner || !repo) | |
| 151 | - throw new Error("GITHUB_REPOSITORY_OWNER and GITHUB_REPOSITORY_NAME required"); | |
| 148 | +const owner = process.env.GITHUB_REPOSITORY_OWNER; | |
| 149 | +const repo = process.env.GITHUB_REPOSITORY_NAME; | |
| 150 | +if (!owner || !repo) | |
| 151 | + throw new Error("GITHUB_REPOSITORY_OWNER and GITHUB_REPOSITORY_NAME required"); | |
| 152 | 152 | |
| 153 | - if (DRY_RUN) console.log("DRY RUN — no changes will be made\n"); | |
| 153 | +if (DRY_RUN) console.log("DRY RUN — no changes will be made\n"); | |
| 154 | 154 | |
| 155 | - const labeled = await markStale(owner, repo); | |
| 156 | - const closed = await closeExpired(owner, repo); | |
| 155 | +const labeled = await markStale(owner, repo); | |
| 156 | +const closed = await closeExpired(owner, repo); | |
| 157 | 157 | |
| 158 | - console.log(`\nDone: ${labeled} ${DRY_RUN ? "would be labeled" : "labeled"} stale, ${closed} ${DRY_RUN ? "would be closed" : "closed"}`); | |
| 159 | -} | |
| 160 | - | |
| 161 | -main().catch(console.error); | |
| 162 | - | |
| 163 | -export {}; | |
| 158 | +console.log(`\nDone: ${labeled} ${DRY_RUN ? "would be labeled" : "labeled"} stale, ${closed} ${DRY_RUN ? "would be closed" : "closed"}`); |