Skip to content
Closed
Show file tree
Hide file tree
Changes from 4 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
25 changes: 16 additions & 9 deletions .github/workflows/hourly-commercial-readiness.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,22 @@ jobs:
ref: ${{ github.event.repository.default_branch }}
persist-credentials: false

- name: setup node
uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6.4.0
with:
node-version: "24.19.0"
cache: npm

- name: verify package-manager toolchain
shell: bash
run: |
set -euo pipefail
test "$(node --version)" = "v24.19.0"
test "$(npm --version)" = "11.17.0"

- name: install lockfile dependencies
run: npm ci --legacy-peer-deps=false --install-links=false

- name: mint dedicated maintainer App token
id: maintainer_app
uses: actions/create-github-app-token@bcd2ba49218906704ab6c1aa796996da409d3eb1 # v3.2.0
Expand All @@ -49,15 +65,6 @@ jobs:
permission-pull-requests: write
permission-statuses: read

- name: setup node
uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4.4.0
with:
node-version: "24"
cache: npm

- name: install lockfile dependencies
run: npm ci

- name: verify active main governance before any write
id: governance
env:
Expand Down
42 changes: 42 additions & 0 deletions test/hourly-commercial-readiness-toolchain-integrity.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
import { readFileSync } from "node:fs";
import { describe, expect, it } from "vitest";

const workflow = readFileSync(
".github/workflows/hourly-commercial-readiness.yml",
"utf8",
);

describe("commercial writer toolchain integrity", () => {
it("uses the exact protected-CI Node/npm execution contract", () => {
expect(workflow).toContain(
"uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6.4.0",
);
expect(workflow).toContain('node-version: "24.19.0"');
expect(workflow).toContain('test "$(node --version)" = "v24.19.0"');
expect(workflow).toContain('test "$(npm --version)" = "11.17.0"');
expect(workflow).toContain(
"npm ci --legacy-peer-deps=false --install-links=false",
);
expect(workflow).not.toContain('node-version: "24"');
expect(workflow).not.toMatch(/run:\s+npm ci\s*(?:\n|$)/);
Comment thread
coderabbitai[bot] marked this conversation as resolved.
Resolved
});

it("installs dependencies before minting write-capable App credentials", () => {
const installIndex = workflow.indexOf(
"npm ci --legacy-peer-deps=false --install-links=false",
);
const mintIndex = workflow.indexOf("- name: mint dedicated maintainer App token");
expect(installIndex).toBeGreaterThan(-1);
expect(mintIndex).toBeGreaterThan(-1);
expect(installIndex).toBeLessThan(mintIndex);
});

it("retains credential isolation and bounded maintainer authority", () => {
expect(workflow).toContain("persist-credentials: false");
expect(workflow).toContain(
"uses: actions/create-github-app-token@bcd2ba49218906704ab6c1aa796996da409d3eb1 # v3.2.0",
);
expect(workflow).toContain("GH_TOKEN: ${{ steps.maintainer_app.outputs.token }}");
expect(workflow).not.toContain("GH_TOKEN: ${{ github.token }}");
});
});
Loading