Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion .github/workflows/redline-pin-bump.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@
# whichever workflow file it lives: uses: askalf/ci/actions/drift-report@<sha> (a watcher's report
# step), uses: askalf/ci/actions/checkout-with-retry@<sha> (any job's checkout),
# uses: askalf/ci/actions/fleet-status@<sha> and fleet-status-check@<sha> (the fleet lanes), and
# uses: askalf/ci/actions/scorecard-publish-check@<sha> (the check after a Scorecard run).
# uses: askalf/ci/actions/scorecard-publish-check@<sha> (the check after a Scorecard run), and
# uses: askalf/ci/actions/tree-tested@<sha> (the skip for a tree a pull request already tested).
# Each pins by SHA so a change reaches it only through a reviewed bump there; this writes those bumps
# (scripts/redline/pin.mjs), and each repo's own gate reviews and merges them.
#
Expand Down Expand Up @@ -123,6 +124,9 @@ jobs:
:(exclude)scripts/scorecard-publish/*.test.mjs
:(exclude)scripts/scorecard-publish/README.md
actions/scorecard-publish-check
scripts/tree-tested
:(exclude)scripts/tree-tested/*.test.mjs
actions/tree-tested
.github/workflows/redline-review.yml
.github/workflows/redline-fix-run.yml
.github/workflows/public-text.yml
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/redline-self-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ jobs:
- run: node scripts/fleet-status/check.test.mjs
# The check after a Scorecard run, and its action's entry, against a stubbed network.
- run: node scripts/scorecard-publish/check.test.mjs
- run: node scripts/tree-tested/check.test.mjs
# The pin bump workflow's bump step, run as the workflow runs it, against a fake gh.
- run: node scripts/redline/pin-bump.test.mjs
# Every fuzz seed through its target, so a target that rots fails here and not only in the weekly fuzz run.
Expand Down
9 changes: 9 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,15 @@ names the commit's date and the pull request it came from.

## November 2026

- A new action, `actions/tree-tested`: on a push to the default branch it says whether the
pull request merged as that commit already passed the same workflow, with every job and every
step green, at a head whose tree is the pushed tree byte for byte, and whether the job asking
ran there too, with one checkout its log shows was the head merged into a base the head holds. A
caller declares the job the same on push and on pull request (`same-on-pull-request: true`) and
skips its build and test steps when the action says so. A direct push, a moved main, a skipped
or failed job or step, a job the pull request did not run, two checkouts, or a read that fails
runs the job in full, as before. Replayed job by job against the last eight pushes of four
repositories on 2026-11-12, it would have skipped 75 of 170 runner minutes. The pin bump moves it like the other actions.
- A second lens, off unless a caller turns it on. A caller on a self-hosted runner that passes
`second-reviewer-login` gets every head the review approves read once more in the same job, as
that account, with a second env file and rubric the host keeps for it, and
Expand Down
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -217,6 +217,7 @@ full commit sha of `main`, so a change here reaches it only through a reviewed b
| [`actions/fleet-status`](actions/fleet-status/action.yml) | Posts the `fleet/verify` and `fleet/review` commit statuses a merge waits on; the lane rules are in [scripts/fleet-status/README.md](scripts/fleet-status/README.md). |
| [`actions/scorecard-publish-check`](actions/scorecard-publish-check/action.yml) | After a Scorecard run: checks that its result reached scorecard.dev, and dispatches Scorecard once more when it did not ([the Scorecard publish check](#the-scorecard-publish-check)). |
| [`actions/fleet-status-check`](actions/fleet-status-check/action.yml) | Checks a repository's fleet-status workflows, its self-hosted `runs-on` labels and its review relay, as that repository's self-test job. |
| [`actions/tree-tested`](actions/tree-tested/action.yml) | On a push to the default branch: says whether the pull request that merged it already passed this workflow, with every job and step, and ran this same job on exactly this tree, so the job can skip its build and test steps instead of running them twice. Any doubt, or any read that fails, runs the job in full. |

| This repository's own | What it does |
|---|---|
Expand Down
48 changes: 48 additions & 0 deletions actions/tree-tested/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
# Says whether a push to the default branch carries a tree that this workflow already tested green
# on the pull request that merged it, so the job can skip its build and test steps instead of
# running them a second time on the same files. The rules are scripts/tree-tested/check.mjs (its
# header says each one), tested without the network by check.test.mjs.
#
# Pinned like the other actions here: a caller names one full commit sha of this repository's main,
# - id: tree
# uses: askalf/ci/actions/tree-tested@<sha>
# with:
# same-on-pull-request: true
# as an early step of a job, and puts `if: steps.tree.outputs.tested != 'true'` on the steps that
# install, build and test. same-on-pull-request is the caller's word that the job runs the same steps,
# commands and inputs on a push as on a pull request (nothing that runs only on push, no matrix a
# push widens, one checkout of the event's own commit); without it the answer is always false. On anything but a push to the default branch it answers false without a
# request. Every read that fails, and every rule that does not hold, answers false too: the job then
# runs in full, as it did before. The step never fails the job.
#
# It checks out nothing and runs on the Node the runner ships. The job's token needs actions: read,
# contents: read and pull-requests: read, which a workflow's default token has unless its
# permissions block leaves one out.
name: Tree tested
description: Say whether this push's tree already passed this workflow on the pull request that merged it.

inputs:
token:
description: A token that reads the repository's commits, pull requests and Actions runs.
required: false
default: ${{ github.token }}
same-on-pull-request:
description: >-
true: the caller declares that this job runs the same steps, commands and inputs on a push as
on a pull request. Anything else, and the answer is false.
required: false
default: 'false'
default-branch:
description: The repository's default branch. A caller passes none.
required: false
default: ${{ github.event.repository.default_branch }}

outputs:
tested:
description: "true when this tree already passed this workflow, with every job and step, and this job ran there on exactly this tree; else false."
run:
description: The run that tested it, when tested is true.

runs:
using: node24
main: main.mjs
15 changes: 15 additions & 0 deletions actions/tree-tested/main.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
// The action's entry. The runner runs this file with the Node it ships (runs.using in action.yml)
// and hands each input over as INPUT_<NAME>. The event's facts (repository, event, ref, sha, the
// workflow's file) are the runner's own GITHUB_* variables; the script reads those.
import { appendFileSync } from 'node:fs';
import { main } from '../../scripts/tree-tested/check.mjs';

const input = (name) => (process.env[`INPUT_${name.toUpperCase()}`] ?? '').trim();

try {
process.exitCode = await main({ ...process.env, GITHUB_TOKEN: input('token'), DEFAULT_BRANCH: input('default-branch'), SAME_ON_PULL_REQUEST: input('same-on-pull-request') });
} catch (e) {
// A failure of the check runs the job in full; it never fails the job.
console.log(`tested in full: ${e.message}`);
if (process.env.GITHUB_OUTPUT) appendFileSync(process.env.GITHUB_OUTPUT, 'tested=false\nrun=\n');
}
3 changes: 2 additions & 1 deletion scripts/redline/pin.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,9 @@ export const CHECKOUT_RETRY_ACTION = `${CI_REPO}/actions/checkout-with-retry`;
export const FLEET_STATUS_ACTION = `${CI_REPO}/actions/fleet-status`;
export const FLEET_STATUS_CHECK_ACTION = `${CI_REPO}/actions/fleet-status-check`;
export const SCORECARD_PUBLISH_CHECK_ACTION = `${CI_REPO}/actions/scorecard-publish-check`;
export const TREE_TESTED_ACTION = `${CI_REPO}/actions/tree-tested`;
/** Every action of this repository a workflow pins as a step; `--action` moves them all. */
export const ACTIONS = [DRIFT_REPORT_ACTION, CHECKOUT_RETRY_ACTION, FLEET_STATUS_ACTION, FLEET_STATUS_CHECK_ACTION, SCORECARD_PUBLISH_CHECK_ACTION];
export const ACTIONS = [DRIFT_REPORT_ACTION, CHECKOUT_RETRY_ACTION, FLEET_STATUS_ACTION, FLEET_STATUS_CHECK_ACTION, SCORECARD_PUBLISH_CHECK_ACTION, TREE_TESTED_ACTION];
/** Every reusable workflow a caller pins, and the caller file that pins it. */
export const CALLERS = [
{ workflow: REVIEW_WORKFLOW, path: '.github/workflows/redline.yml' },
Expand Down
2 changes: 1 addition & 1 deletion scripts/redline/review.test.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -311,7 +311,7 @@ console.log('\n a fork: ci-repo and reviewer-login');
const fork = probe({ REDLINE_CI_REPO: 'someone/ci', REDLINE_REVIEWER_LOGIN: 'Fork-Bot' });
const got = fork.status === 0 ? JSON.parse(fork.stdout) : null;
check('in a fork every pinned workflow and action is the fork\'s, and the poster trusts the fork alone',
got !== null && got.paths.length === 9 && got.paths.every((p) => p.startsWith('someone/ci/')) && JSON.stringify(got.tooling) === '["someone/ci"]' && got.login === 'fork-bot');
got !== null && got.paths.length === 10 && got.paths.every((p) => p.startsWith('someone/ci/')) && JSON.stringify(got.tooling) === '["someone/ci"]' && got.login === 'fork-bot');
const ours = probe({});
const today = ours.status === 0 ? JSON.parse(ours.stdout) : null;
check('unset, it is today\'s: askalf/ci, sprayberry-redline, and askalf/askalf still accepted', today !== null && today.paths.every((p) => p.startsWith('askalf/ci/'))
Expand Down
Loading
Loading