Skip to content

tree-tested: allow other repositories checked out at a pinned commit - #217

Merged
askalf merged 1 commit into
mainfrom
tree-tested-pinned-checkouts
Nov 13, 2026
Merged

askalf merged 1 commit into
mainfrom
tree-tested-pinned-checkouts

Conversation

@askalf

@askalf askalf commented Nov 13, 2026

Copy link
Copy Markdown
Owner

A job that also checks out another repository, at a full commit sha that its own tree names (read from a file of the checkout), never skipped. The rule wanted exactly one actions/checkout step and one HEAD is now at line in the whole log, and such a job has two of each.

The change

  • A new input, pinned-checkouts, lists those repositories (owner/name, separated by spaces, commas or new lines). It is the caller's word that each one is checked out at a sha the tree names. Empty, the default, keeps the rule as strict as before.
  • checkoutMerge cuts the log into steps and reads each actions/checkout step's repository, ref and path from the inputs the runner prints under with:, with expressions already filled in. A checkout wrapped in a composite action prints its own inner actions/checkout group, so it is read the same way.
  • Every HEAD is now at line must be inside a checkout step, one to a step.
  • Exactly one checkout is of the job's own repository, and it shows the pull request merge, as before.
  • Every other checkout must:
    • be of a named repository;
    • be at a ref that is a full commit sha;
    • go into a relative path that is a directory of its own (not missing, not ., not absolute, no ..);
    • have its HEAD is now at line at that commit.

Checks

  • scripts/tree-tested/check.test.mjs: 79 passed. New cases cover:
    • the named and unnamed repository;
    • a branch, tag, short sha or no ref;
    • each bad path;
    • a checkout that landed on another commit;
    • two HEAD is now at lines in one checkout, or none;
    • a second checkout of the job's own repository at a pinned sha;
    • a ref under env: that must not be read as an input;
    • a HEAD is now at line before any step.
  • Run over four real pull request job logs:
    • a job that checks out a second repository at a pinned sha reads its merge when that repository is named, and is refused when it is not;
    • three jobs with one checkout each read their merge exactly as before.

A job that also checks out another repository, at a full commit sha its own tree names, never
skipped: the rule wanted one actions/checkout step and one "HEAD is now at" line in the log.

The new pinned-checkouts input names such repositories. The log is cut into steps, and each
actions/checkout step's repository, ref and path are read from the inputs the runner prints under
"with:". Exactly one checkout is of the job's own repository and shows the pull request merge, as
before. Every other one must be of a named repository, at a ref that is a full commit sha, into a
relative directory of its own, and at that commit. A "HEAD is now at" line outside a checkout step
still runs the push in full. With the input empty, the rule is as strict as it was.

@sprayberry-redline sprayberry-redline left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Verdict: approve. The action now passes the pinned checkout input through to the decision logic, and the log parser verifies named secondary checkouts are commit-pinned, isolated under the workspace, and match their recorded checkout commit. The added unit coverage exercises accepted pinned checkouts and the relevant rejection paths while preserving the existing merge validation.

@askalf
askalf merged commit b4621fe into main Nov 13, 2026
13 checks passed
@askalf
askalf deleted the tree-tested-pinned-checkouts branch November 13, 2026 16:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants