Skip to content

Commit 0f5a908

Browse files
committed
ci: run timing summary from trusted base
1 parent 39aec0b commit 0f5a908

3 files changed

Lines changed: 13 additions & 2 deletions

File tree

‎.github/workflows/ci.yml‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1988,10 +1988,10 @@ jobs:
19881988
runs-on: ubuntu-24.04
19891989
timeout-minutes: 5
19901990
steps:
1991-
- name: Checkout
1991+
- name: Checkout timing summary helper
19921992
uses: actions/checkout@v6
19931993
with:
1994-
ref: ${{ needs.preflight.outputs.checkout_revision || github.sha }}
1994+
ref: ${{ github.event_name == 'pull_request' && github.event.pull_request.base.sha || needs.preflight.outputs.checkout_revision || github.sha }}
19951995
fetch-depth: 1
19961996
fetch-tags: false
19971997
persist-credentials: false

‎docs/ci.md‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,8 @@ GitHub may mark superseded jobs as `cancelled` when a newer push lands on the sa
4545

4646
Use `pnpm ci:timings`, `pnpm ci:timings:recent`, or `node scripts/ci-run-timings.mjs <run-id>` to summarize wall time, queue time, slowest jobs, failures, and the `pnpm-store-warmup` fanout barrier from GitHub Actions. CI also uploads the same run summary as a `ci-timings-summary` artifact. For build timing, check the `build-artifacts` job's `Build dist` step: `pnpm build:ci-artifacts` prints `[build-all] phase timings:` and includes `ui:build`; the job also uploads the `startup-memory` artifact.
4747

48+
For pull request runs, the terminal timing-summary job runs the helper from the trusted base revision before passing `GH_TOKEN` to `gh run view`. That keeps the tokened query out of branch-controlled code while still summarizing the pull request's current CI run.
49+
4850
## Real behavior proof
4951

5052
External contributor PRs run a `Real behavior proof` gate from

‎test/scripts/ci-workflow-guards.test.ts‎

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,15 @@ describe("ci workflow guards", () => {
7474
expect(timingJob.if).toContain("always()");
7575
expect(timingJob.if).toContain("!cancelled()");
7676

77+
const checkoutStep = timingJob.steps.find(
78+
(step) => step.name === "Checkout timing summary helper",
79+
);
80+
expect(checkoutStep.uses).toBe("actions/checkout@v6");
81+
expect(checkoutStep.with.ref).toBe(
82+
"${{ github.event_name == 'pull_request' && github.event.pull_request.base.sha || needs.preflight.outputs.checkout_revision || github.sha }}",
83+
);
84+
expect(checkoutStep.with["persist-credentials"]).toBe(false);
85+
7786
const writeStep = timingJob.steps.find((step) => step.name === "Write CI timing summary");
7887
expect(writeStep.env).toMatchObject({ GH_TOKEN: "${{ github.token }}" });
7988
expect(writeStep.run).toContain(

0 commit comments

Comments
 (0)