Repository navigation
v2.7.0 — Red Runs Edition
A red CI run now gets a FAILED receipt, written by a separate job that is the only one with write access.
Added
- A reusable workflow,
.github/workflows/receipt.yml: call it from a job thatneedsyour test job. The test job uploads its output as an artifact; the receipt job downloads it and saves the receipt totaf-receipts. Withif: ${{ !cancelled() }}on the calling job a red run is recorded asFAILED, and only that job hascontents: write. Inputs:artifact-name,test-output-file,test-result,target-branch,skipped-names,runs-on,commit-message. The action's outputs are passed through.test-result: ${{ needs.<test job>.result }}is required: a failed test job is recorded asFAILEDeven when its output counts no failed test. No artifact after a failed test job: no receipt, and a warning that names the causes (the build failed first, an upload step withoutif: ${{ !cancelled() }}, a wrong name). No artifact after a test job that passed means a wrongartifact-name, and the job fails. The README now leads with this setup. - Action input
fail-on-failed-tests(defaultfalse): fail the step when the receipt isFAILED, after the receipt is written and pushed and the outputs are set. A single job whose test step hascontinue-on-error: truegets itsFAILEDreceipt and still goes red, with no extra failing step. - Action input
test-outcome(optional): the test step's outcome or the test job's result. Onlyfailurecounts. The receipt is thenFAILEDeven if the output counts no failed test (a test file that did not compile, a coverage threshold, a linter innpm test), and output that counts nothing at all gets aFAILEDreceipt with zero counts instead of no receipt. Left out, the result comes from the output alone, as before.
Fixed
- On the current branch (no
target-branch), a push another run beat is tried again. The receipt was lost with a warning. The action now fetches the branch into a temporary worktree, adds the receipt to the fresh.tafthere and pushes, up to 5 tries in all: the same retrytarget-branchhas. The worktree holds only.tafand runs no hooks; anything that goes wrong in it ends on the usual warning, not a failed step. The job's checkout is not moved: later steps run on the commit that was tested, which keeps its own receipt commit, unpushed, so its.taflacks the other runs' receipts. Commits that earlier steps made go out with the receipt only when the first push succeeds; a retry pushes the receipt alone. Changed or staged files in the checkout do not block the retry. As ontarget-branch, the retried receipt sits on top of the newer commit and has a new timestamp. Tries are spaced by a short random wait, on both paths. - A push that lost the race while it ran is tried again too (
cannot lock ref/failed to update ref), on both paths. It was treated as a refusal. - The push target on the current branch is the branch's configured upstream (
branch.<name>.remoteand.merge), pushed asHEAD:refs/heads/<branch>, not a baregit push. Setups that relied onpush.defaultorpushRemotepush to the upstream now. - The try count is exact when a retry stops early (a failed fetch): the message said the push failed 5 times.
- The lost-receipt warning follows the last failure: a retry the server refused, or a
.tafthat could not be written, no longer reads as a lost race. - The badge shows a
FAILEDreceipt with no failed test asrun failedin the fail colour, not "5/5 passing". - The warning for a receipt that can't be pushed says so plainly: the receipt was not saved, git's reason, and the fix (
permissions: contents: writeon the job, ortarget-branch: taf-receiptsfor a protected branch).fail-on-push-errorstill defaults tofalse.
Changed
- This repo's own CI uses the same two-job setup: the test job uploads its output and a separate receipt job, the only one with
contents: write, records the run, a failed one too, with this commit's action (uses: ./). Before, a failed test run wrote no receipt. - The reusable workflow pins the action to the release it ships in. A test fails when that pin and
package.json's version differ.
Tests: 227 passing.
Upgrade: uses: Wolfe-Jam/faf-taf-git@v2.7.0, or call the reusable workflow Wolfe-Jam/faf-taf-git/.github/workflows/receipt.yml@v2.7.0 (see the README, "Set it up").
FAF defines. AGENTS.md instructs. AI codes.