Repository navigation
fix: run the backfill post step unless the job was cancelled - #13
Merged
Merged
Conversation
A failed step before the post step, such as mortise check on a problem of the app, skipped the backfill. The post step now runs unless the job was cancelled. It still does nothing when the main step did not install mortise.
nWidart
force-pushed
the
fix/backfill-post-if-cancelled
branch
from
November 28, 2026 17:09
5065ec3 to
80fdc9d
Compare
nWidart
marked this pull request as ready for review
November 28, 2026 17:09
nWidart
commented
Nov 28, 2026
nWidart
left a comment
Collaborator
Author
There was a problem hiding this comment.
GPT-6.2 Sol with OCR review of 80fdc9d
Verdict: CHANGES · Review effort: 2/5
Security: None found.
Tests: All 12 tests passed on Linux with the default temp path. The tests pin the metadata and cover the missing-state guard, but CI does not exercise post-step scheduling on a cancelled job or an actual backfill after a failed default-branch job.
Coverage: 2 of 2 files reviewed in OCR delegation mode, 1 excluded by OCR.
| # | Severity | Finding | Where |
|---|---|---|---|
| 1 | Medium | Handle CRLF checkouts | tests/post.test.js:176, inline |
| 2 | Medium | Encode the fixture URL | tests/post.test.js:197, inline |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #12.
Owner review: this changes when a step that reads
MORTISE_TOKENruns (the backfill post step now also runs after a failed step), and it leads to thev1.1.1release.What changes
action.yml:post-if: success()becomespost-if: '!cancelled()', as decided on The backfill post step is skipped when a step of the job fails #12. The post step runs after a failed step, and not when the job is cancelled.README.md: the sentence "a failed step before it means no backfill on that run" is replaced: the backfill also runs after a failed step, not on a cancelled job, and does nothing when the action did not installmortise. Whenmortise pushfailed or did not run, the backfill still sends the past weeks and the next push sends the checked-out commit.tests/post.test.js: a test that pins the condition. A test runsmain.jsagainst a fake release served fromfile://that fails half way: no release, a wrong SHA-256, and a binary that prints another version. It checks each error, thatGITHUB_STATEstays empty, and that the post step then prints nothing. It runs on Linux, macOS and Windows. A third test, which skips on Windows, shows that a good fake release writes the state the post step reads.post.js,main.jsandsetup.shdo not change.Why a half-way failure does nothing
setup.shwrites the state (mortise=andversion=) in its last lines, after the download, the SHA-256 check, the unpack and the--versioncheck. Every failure before that exits throughfailfirst.post.jsreturns without a word when either state value is missing. A failed input check inmain.jsexits beforesetup.shruns. When a step beforesetup-mortisefailed (such as the checkout), the main step never ran, so the runner has no post step for it at all.The cases the old condition hid
In every case the post step exits 0, so it never changes the result of the job, and it does nothing on a pull request, on another branch or without a token, as before.
post.jsnever prints the token;mortisehides it in every message it prints from the service.mortise pushstep failed.mortise backfillsays the token was refused and exits non-zero; the post step prints one warning. The job had already failed.setup-mortiseand beforemortise pushfailed (such as the tests), so the service has no snapshot of HEAD. The backfill sends the past weeks (it never sends HEAD itself). This does no harm: the service knows the app from its token, a past commit never replaces a live push, does not count as the first snapshot of the app, and does not move the current state of the app. The next push sends HEAD. The past weeks only arrive before the current one.fail-fastof a matrix): no backfill, as before.Proof
node --test tests/post.test.js, 13 pass locally; CI runs them on Linux, macOS and Windows.uses: ./withbackfill: trueand a fake token, then a step that fails on purpose. Run https://github.com/mortise-dev/setup-mortise/actions/runs/46168878540: "Fail on purpose: failure", then "Post Run ./: success" (withpost-if: success()it was "skipped", as in the run cited on The backfill post step is skipped when a step of the job fails #12). On a pull request the post step prints nothing, so this proves the step runs, not what it sends.v1.1.1gets the same check with the exact generated workflow inmortise-check, whose check step fails on purpose, beforev1moves.