Skip to content

gate-report.mjs

Posts the digest and tail of a red CI gate run where an agent can read them.

Contributor toolinggate-report.mjs

What it does

Reads gate.log from the working directory and keeps every line matching a failure marker, with six lines of context. That digest plus the last 120 lines goes to the pull request the run measures. A push or scheduled run with no pull request behind it posts the same report to the standing ci-log-drop mailbox issue, and the job log keeps a copy. Both CI lanes (check.yml and check-heavy.yml, ADR-0013) run it from their failure steps; read a digest back with node tools/forge.mjs ci-why <run-number>.

Usage

The workflow's failure step runs it with the job's token in the environment:

bash
node tools/gate-report.mjs

Replace the following: nothing — the script takes no arguments. It reads gate.log from the working directory and the standard workflow variables (GITHUB_EVENT_PATH, GITHUB_TOKEN and their siblings) from the environment.

Options

No options.

Inputs and outputs

On a pull-request event the caller gets a comment on that pull request holding the digest and tail, and a confirmation line on stdout. On any other event the whole report goes to stdout. A missing gate.log is reported as such, not an error; a failed comment post exits 1 with the HTTP status.

Examples

Run it by hand inside a checkout that holds a gate.log to preview the digest a red run would post:

bash
GITHUB_EVENT_PATH=/dev/null GITHUB_EVENT_NAME=push node tools/gate-report.mjs

Notes

The digest's failure markers deliberately exempt ESLint's clean-run summary line — a clean ✖ N problems (0 errors, ...) is not a failure. Outside a workflow the script needs the GITHUB_* variables the runner would provide; without them it still prints a report, headed by placeholder values.

Source

tools/gate-report.mjs — part of Contributor tooling