Commit ae6619e
fix(ci): skip SARIF upload when code scanning is administratively disabled (#353)
## Summary
The hypatia-scan reusable's \`Upload SARIF\` step hard-fails when the
consumer repo has code scanning disabled (private repo without Advanced
Security, or any repo with the feature admin-disabled). That's a
legitimate consumer-side config choice, not a regression.
This adds a \`cs-probe\` step that queries \`/code-scanning/alerts\`
(continue-on-error so the probe itself never blocks) and gates the
upload step on the probe's verdict.
## Reproducer
[.git-private-farm#69 run
26843343488](https://github.com/hyperpolymath/.git-private-farm/actions/runs/26843343488):
\`\`\`
hypatia.sarif written: 48 result(s).
Run github/codeql-action/upload-sarif@...
sarif_file: hypatia.sarif
Validating hypatia.sarif
##[error]Code scanning is not enabled for this repository.
Please enable code scanning in the repository settings.
\`\`\`
The scan + SARIF conversion both succeed; the \`actions: read\` perm I
added in #352 correctly grants the upload its scope; the upload only
fails because the **feature itself** is not enabled on the consumer
repo.
## Preserved guarantees
Per the existing design comment (post-#35):
- ✅ Fork PRs still skip (token read-only) — unchanged.
- ✅ Genuine permission regression still hard-fails loud (the probe
checks only whether the feature is enabled, not whether the upload would
otherwise succeed).
- ✅ Malformed SARIF / API outage still hard-fails loud — same reason.
- ✅ Hypatia findings still land as a build artifact even when SARIF
upload is skipped (the upload-artifact step is unaffected).
The probe is **fail-open**: if the API call errors for any reason (rate
limit, transient outage), \`enabled\` ends unset (no \`enabled=true\` in
the output), upload is skipped. Loud-red regressions remain loud — the
probe just adds a graceful skip for the specific case where the feature
is administratively unavailable.
## Test plan
- [ ] .git-private-farm#69 re-run picks up new reusable SHA → SARIF step
skips with notice instead of hard-fail.
- [ ] Public estate consumers (where code scanning IS enabled by
default) still publish SARIF normally.
- [ ] Fork PRs still skip via the unchanged second clause of the
\`if:\`.
## Blast radius
Same as #352 — all estate consumers of \`hypatia-scan-reusable.yml\`.
The change is fail-open and additive: existing green paths stay green;
previously-red paths that were red BECAUSE of disabled-feature now go
green.
## Related
- #352 — added the perms; this completes the resilience
- .git-private-farm#69 — first consumer hitting the disabled-feature
path
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>1 parent 3b3549e commit ae6619e
1 file changed
Lines changed: 32 additions & 9 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
281 | 281 | | |
282 | 282 | | |
283 | 283 | | |
| 284 | + | |
| 285 | + | |
| 286 | + | |
| 287 | + | |
| 288 | + | |
| 289 | + | |
| 290 | + | |
| 291 | + | |
| 292 | + | |
| 293 | + | |
| 294 | + | |
| 295 | + | |
| 296 | + | |
| 297 | + | |
| 298 | + | |
| 299 | + | |
| 300 | + | |
| 301 | + | |
| 302 | + | |
| 303 | + | |
| 304 | + | |
284 | 305 | | |
285 | | - | |
286 | | - | |
287 | | - | |
288 | | - | |
289 | | - | |
290 | | - | |
291 | | - | |
292 | | - | |
293 | | - | |
| 306 | + | |
| 307 | + | |
| 308 | + | |
| 309 | + | |
| 310 | + | |
| 311 | + | |
| 312 | + | |
| 313 | + | |
| 314 | + | |
| 315 | + | |
294 | 316 | | |
295 | 317 | | |
| 318 | + | |
296 | 319 | | |
297 | 320 | | |
298 | 321 | | |
| |||
0 commit comments