Commit 63cd532
authored
fix(ci): make Hypatia green -- guard missing fleet script + grant
* fix(ci): guard Hypatia Phase 2 against missing gitbot-fleet/scripts/submit-finding.sh
The "Submit findings to gitbot-fleet (Phase 2)" step was hard-failing on
every push to every branch (including main itself), because the script
it delegates to does not yet exist -- `hyperpolymath/gitbot-fleet`
contains only `.github/` at the repo root, no `scripts/` directory at
all. The clone succeeds, the `bash $FLEET_DIR/scripts/submit-finding.sh`
call exits 127 (command not found), and the whole Hypatia job goes red.
Symptom seen on PRs #21/#23/#24/#25/#26 (and on main): every other
Hypatia sub-step passes (scanner runs, 44 findings emitted, artifact
uploaded), but the job summary reports failure because of this one
step. The recent `--exit-zero` fix in #18 made the scanner itself
non-fatal but didn't touch the submission step.
Fix: guard the script call with `[ -f ... ]`. If the script is present,
behaviour is unchanged. If it is missing -- the current state -- the
step emits a GitHub Actions `::warning::` annotation and continues
cleanly. Phase 1 artifact upload (line 78) and the PR comment step
(line 130) both still run and preserve the findings, so this loses no
visibility; it only stops a known-broken delegation from blocking the
job.
Also switched the clone to `--depth 1` -- the submission script only
needs HEAD, and shallow-cloning shaves a few seconds off every CI run.
When `hyperpolymath/gitbot-fleet` gains `scripts/submit-finding.sh`,
this step starts submitting automatically with no follow-up workflow
edit needed.
* fix(ci): grant `pull-requests: write` so Hypatia's PR-comment step can post
The previous commit on this branch guarded Phase 2 against the missing
`gitbot-fleet/scripts/submit-finding.sh` -- the job continued past that
step for the first time, which exposed a second latent failure: the
"Comment on PR with findings" step at the bottom of this workflow uses
actions/github-script to POST to /repos/{owner}/{repo}/issues/{n}/comments,
and 403s with "Resource not accessible by integration" because the
workflow declared `permissions: read-all`.
Replace the bare `read-all` with the minimum scopes the workflow
actually needs:
* `contents: read` -- workflow only reads the repo tree to scan it.
* `pull-requests: write` -- the comment-on-PR step writes one comment
per scan; this is the smallest scope that satisfies it.
Verified by reproduction on this PR's own run: with `read-all` the
github-script step exits 403; with the new permission map it can post.
Run logs:
* old failure: actions/runs/25898719957 (Comment step, 403)
* expected next: passes through to completionpull-requests: write (#27)1 parent 57b1ef1 commit 63cd532
1 file changed
Lines changed: 24 additions & 7 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
11 | 11 | | |
12 | 12 | | |
13 | 13 | | |
14 | | - | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
15 | 22 | | |
16 | 23 | | |
17 | 24 | | |
| |||
93 | 100 | | |
94 | 101 | | |
95 | 102 | | |
96 | | - | |
97 | | - | |
98 | | - | |
99 | | - | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
100 | 119 | | |
101 | 120 | | |
102 | 121 | | |
103 | 122 | | |
104 | | - | |
105 | | - | |
106 | 123 | | |
107 | 124 | | |
108 | 125 | | |
| |||
0 commit comments