Skip to content

feat: add a backfill input - #10

Merged
nWidart merged 2 commits into
mainfrom
feat/add-backfill-input
Nov 28, 2026
Merged

nWidart merged 2 commits into
mainfrom
feat/add-backfill-input

Conversation

@nWidart

@nWidart nWidart commented Nov 28, 2026

Copy link
Copy Markdown
Collaborator

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, same version output, same failures, and the post step prints nothing. The change also handles MORTISE_TOKEN and 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 (default false) and path (default .).

  • main.js checks that backfill is a boolean, then runs the unchanged setup.sh with bash. On Windows that is the bash of Git for Windows, the same bash shell: bash uses. The runner already passes INPUT_VERSION and INPUT_TOKEN, the names setup.sh reads. The only change to setup.sh: it writes the absolute path of the installed binary and its tag to GITHUB_STATE.

  • post.js, with backfill: 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:

    • the event is push
    • GITHUB_REF is refs/heads/<default branch from the event>
    • MORTISE_TOKEN is not empty
    • the main step installed mortise

    On 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 of mortise backfill, or a failure to start it, becomes a ::warning::. The post step always exits 0. The token reaches mortise only 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: true and path, and MORTISE_TOKEN in env: on the setup-mortise step. A token set only on the step of mortise push does not reach the post step, and the section says so. It also covers:

  • fetch-depth: 0
  • filter: blob:none together with persist-credentials
  • the success-only rule
  • the fact that the backfill never fails the job

It 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:
    • the gate: event, branch, tag, letter case of the branch, token, missing event file, missing state
    • that nothing is printed on runs the gate stops
    • the version check
    • path resolved against GITHUB_WORKSPACE
    • that the installed binary runs with a changed PATH and working directory, and gets the token and MORTISE_CLOUD_URL
    • exits 1, 2 and 4, and a binary that cannot start, giving a warning with exit 0 and no token in the output
    • that the main step refuses an invalid backfill
  • In the fixture job, on all four runners:
    • The fixture binary is now built from the v1.3.0 commit.
    • The existing install checks stay as they are.
    • New: post.js runs the real installed binary as on a push to main from another working directory. On the shallow checkout it reports the missing history and exits 0, with no warning and no token in the output.
    • New: on a pull request the post step prints nothing.
    • New: a real uses: ./action with backfill: true, followed by a step that changes PATH and the working directory, so the real post step runs at the end of the job.
  • actionlint moves from 1.7.7 to 1.7.12 so that it knows node24.

After the merge

The owner releases the new version and moves the v1 tag.

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 nWidart added the request-sol-review PR bot: ask GPT-6.2 Sol for a review label Nov 28, 2026
@nWidart nWidart self-assigned this Nov 28, 2026
@nWidart nWidart added review-sol-started PR bot: sol review started and removed request-sol-review PR bot: ask GPT-6.2 Sol for a review labels Nov 28, 2026

@nWidart nWidart left a comment

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

Comment thread main.js Resolved
Comment thread post.js Resolved
Comment thread .github/workflows/ci.yml Resolved
@nWidart nWidart added review-sol-ended PR bot: sol review ended and removed review-sol-started PR bot: sol review started labels Nov 28, 2026
@nWidart nWidart added request-sol-review PR bot: ask GPT-6.2 Sol for a review review-sol-started PR bot: sol review started and removed request-sol-review PR bot: ask GPT-6.2 Sol for a review review-sol-ended PR bot: sol review ended labels Nov 28, 2026

@nWidart nWidart left a comment

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

Comment thread post.js Resolved
Comment thread .github/workflows/ci.yml Resolved
@nWidart nWidart added review-sol-ended PR bot: sol review ended owner-approved Owner looked at it: the thread may merge and removed review-sol-started PR bot: sol review started labels Nov 28, 2026
@nWidart
nWidart merged commit ccc1e8b into main Nov 28, 2026
14 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

owner-approved Owner looked at it: the thread may merge review-sol-ended PR bot: sol review ended

Projects

None yet

Development

Successfully merging this pull request may close these issues.

feat: add a backfill input

1 participant