Repository navigation
feat: add a backfill input - #10
Conversation
The action becomes a Node 24 JavaScript action so it can have a post step. main.js runs setup.sh as before. post.js runs mortise backfill <path> after the steps of the job, on a push to the default branch with MORTISE_TOKEN set, and never fails the job.
nWidart
left a comment
There was a problem hiding this comment.
GPT-6.2 Sol with OCR review of 6929fc4
Verdict: CHANGES · Review effort: 3/5
Security: The invalid backfill error writes raw input into the GitHub Actions command stream. Escape the input before logging it so embedded line breaks cannot start separate workflow commands.
Tests: The unit tests cover the ordinary event gates, path resolution and nonzero exits. They miss branch deletion and multiline input, and the fixture makes no assertion about the actual registered post step.
Coverage: 6 of 6 files reviewed in OCR delegation mode, with 1 excluded by OCR and no skips.
| # | Severity | Finding | Where |
|---|---|---|---|
| 1 | High | Escape invalid backfill input | main.js:19, inline |
| 2 | Medium | Skip branch deletion pushes | post.js:36, inline |
| 3 | Medium | Assert registered post execution | .github/workflows/ci.yml:156, inline |
nWidart
left a comment
There was a problem hiding this comment.
GPT-6.2 Sol with OCR review of aa326ba
Verdict: CHANGES · Review effort: 3/5
Security: None found.
Tests: All 10 local unit tests passed. The fixture checks a direct invocation of post.js against a shallow clone, but it does not assert that GitHub runs the registered post step or cover Git lookup after a PATH replacement.
Coverage: 6 of 6 reviewable files reviewed, with 1 file excluded by OCR.
| # | Severity | Finding | Where |
|---|---|---|---|
| 1 | Medium | Preserve Git for backfill | post.js:77, inline |
| 2 | Medium | Assert registered post execution | .github/workflows/ci.yml:148, inline |
Closes #9.
Owner review: the action changes from a composite action to a Node 24 JavaScript action, so that it can have a post step. A self-hosted runner needs runner 2.328 or later. Nothing else changes for a user who does not set
backfill: same install, same PATH, sameversionoutput, same failures, and the post step prints nothing. The change also handlesMORTISE_TOKENand fixes the step shape that onboarding workflows will copy.What changes
action.yml:runs: using: node24,main: main.js,post: post.js,post-if: success(). It adds two inputs:backfill(defaultfalse) andpath(default.).main.jschecks thatbackfillis a boolean, then runs the unchangedsetup.shwith bash. On Windows that is the bash of Git for Windows, the same bashshell: bashuses. The runner already passesINPUT_VERSIONandINPUT_TOKEN, the namessetup.shreads. The only change tosetup.sh: it writes the absolute path of the installed binary and its tag toGITHUB_STATE.post.js, withbackfill: true, runs<installed mortise> backfill <GITHUB_WORKSPACE>/<path>in the workspace. It finds the binary through the saved state, so a job that changes PATH or the working directory does not affect it. It runs only when all of these hold:pushGITHUB_REFisrefs/heads/<default branch from the event>MORTISE_TOKENis not emptyOn every other run it prints nothing.
If the installed release is older than 1.3.0, the post step prints one
::warning::and skips. Any non-zero exit ofmortise backfill, or a failure to start it, becomes a::warning::. The post step always exits 0. The token reachesmortiseonly through the environment and is never printed.The action never passes
--weeks.No npm dependencies, no build step, no
dist.README
There is a new section, "With past history". It gives the step shape with
backfill: trueandpath, andMORTISE_TOKENinenv:on thesetup-mortisestep. A token set only on the step ofmortise pushdoes not reach the post step, and the section says so. It also covers:fetch-depth: 0filter: blob:nonetogether withpersist-credentialsIt adds a line on Node 24 and self-hosted runners.
Tests
tests/post.test.js(node --test, CI job "Unit tests" on Linux, macOS and Windows) tests:pathresolved againstGITHUB_WORKSPACEMORTISE_CLOUD_URLbackfillpost.jsruns the real installed binary as on a push tomainfrom another working directory. On the shallow checkout it reports the missing history and exits 0, with no warning and no token in the output.uses: ./actionwithbackfill: true, followed by a step that changes PATH and the working directory, so the real post step runs at the end of the job.node24.After the merge
The owner releases the new version and moves the
v1tag.