Skip to content

v2.7.0 — Red Runs Edition

Choose a tag to compare

@Wolfe-Jam Wolfe-Jam released this 17 Nov 06:45
· 9 commits to main since this release
f55c50c

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 that needs your test job. The test job uploads its output as an artifact; the receipt job downloads it and saves the receipt to taf-receipts. With if: ${{ !cancelled() }} on the calling job a red run is recorded as FAILED, and only that job has contents: 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 as FAILED even 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 without if: ${{ !cancelled() }}, a wrong name). No artifact after a test job that passed means a wrong artifact-name, and the job fails. The README now leads with this setup.
  • Action input fail-on-failed-tests (default false): fail the step when the receipt is FAILED, after the receipt is written and pushed and the outputs are set. A single job whose test step has continue-on-error: true gets its FAILED receipt 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. Only failure counts. The receipt is then FAILED even if the output counts no failed test (a test file that did not compile, a coverage threshold, a linter in npm test), and output that counts nothing at all gets a FAILED receipt 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 .taf there and pushes, up to 5 tries in all: the same retry target-branch has. The worktree holds only .taf and 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 .taf lacks 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 on target-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>.remote and .merge), pushed as HEAD:refs/heads/<branch>, not a bare git push. Setups that relied on push.default or pushRemote push 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 .taf that could not be written, no longer reads as a lost race.
  • The badge shows a FAILED receipt with no failed test as run failed in 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: write on the job, or target-branch: taf-receipts for a protected branch). fail-on-push-error still defaults to false.

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.