ci: let a pull request keep the image it just built - #135
Conversation
Stage artifacts and Upload build artifacts were gated on `github.event_name != 'pull_request'`, alongside Send binary and the publish job. Those two need the guard -- one uses the Telegram bot secret, the other writes shared release assets. The upload does not: actions/upload-artifact is run-scoped and touches no secret and no shared state. The effect was that a PR compiled a complete firmware image and then threw it away. A contributor adding a device profile could not obtain the image their own PR had just built, so the only route to a flashable file was asking a maintainer to dispatch build-one. builder#119 hit exactly this: the author planned to "flash the CI artifact once this branch produces one", which would never have resolved. Producing fw-* on a pull request cannot reach a release, because publish carries its own event_name guard independently of these steps. And the matrix is narrowed to affected devices by ci-matrix.py, so this is on the order of one image per PR rather than the full device set. retention-days 1 -> 7: a nightly's artifact is consumed by publish in the same run and never needs to outlive it, while one day is too short a window for a contributor in another timezone to act on.
PR Summary by QodoRetain pull request firmware artifacts for contributor testing
AI Description
Diagram
High-Level Assessment
Files changed (1)
|
Code Review by Qodo
1.
|
Addresses the review finding on this PR. The previous commit set
retention-days: 7 unconditionally, which was inconsistent with its own
stated rationale: a nightly's artifact is consumed by `publish` inside
the same run and nobody downloads it afterwards, so a nightly has no use
for the longer window -- and the nightly builds the whole device matrix
daily, so a week of retention keeps seven full matrices in storage
instead of one, for no reader.
Make it per-event, which is what the reasoning argued for:
retention-days: ${{ github.event_name == 'pull_request' && 7 || 1 }}
pull_request gets 7, every other event keeps the existing 1.
|
Fixed in b14cc52 — the finding was correct, and it caught a real inconsistency The rationale I wrote for the change argued that a nightly's artifact is consumed Now per-event: retention-days: ${{ github.event_name == 'pull_request' && 7 || 1 }}
Also worth recording that the first revision already demonstrated the change |
Stage artifactsandUpload build artifactswere gated ongithub.event_name != 'pull_request', sharing that guard withSend binaryandthe
publishjob. Those two need it — one uses the Telegram bot secret, theother writes shared release assets. The upload does not:
actions/upload-artifactis run-scoped and touches no secret and no sharedmutable state.
The effect is that a pull request compiles a complete firmware image and then
discards it.
Stage artifacts,Upload build artifacts,Send binaryandPublish releasesall report skipped on a green PR run, and the artifactcount is zero. A contributor adding a device profile therefore cannot obtain the
image their own PR just built — the only route to a flashable file is asking a
maintainer to dispatch
build-onefor them.#119 hit exactly this. The author planned to "flash the CI artifact once this
branch produces one", which would never have resolved; I dispatched
build-oneby hand to unblock it.
Why this is safe
publishcarries its owngithub.event_name != 'pull_request'in itsif:,independently of these steps:
So producing
fw-*on a pull request cannot reach a release. It only makes theimage downloadable from the run that built it.
Send binarykeeps its guardtoo, so no PR touches the Telegram secret or the dev channel.
What it costs
selectnarrows the matrix viaci-matrix.py, and the cost depends on what thePR touches — measured, not estimated:
So the case this change exists for — a contributor adding a device — produces a
single ~7 MB artifact. A workflow change like this one produces 15, roughly
100 MB at 7-day retention. Both are modest, but the second is not "one image per
PR" and I would rather state it than round it down.
Retention, per event
A nightly's artifact is consumed by
publishinside the same run and nobodydownloads it afterwards, so a nightly gains nothing from a longer window — and
since it builds the whole matrix daily, a week of retention would keep seven
full matrices in storage instead of one, for no reader. A PR builds a handful
and has a person waiting on them, so one day is too short there.
The first revision of this PR set
7unconditionally, which contradicted thatreasoning; corrected in b14cc52 after review.
Verification
The change is two
if:simplifications and one retention bump; the guards thatmatter are untouched.
.github/scripts/lint-workflow-shell.pypasses — 31 runblocks, all clean.
The honest test is this PR's own run:
Upload build artifactsshould nowsucceed and attach
fw-*, whilePublish releasesstays skipped. If both holdhere, the change does what it claims. Worth confirming that before merge rather
than taking the reasoning for it.