mirror of
https://github.com/paperclipai/paperclip.git
synced 2026-11-22 20:29:18 +01:00
ci: bootstrap Node before pnpm setup (#12808)
## Thinking Path The trusted workflows currently invoke `pnpm/action-setup@v6` before installing the repository Node version. On hosts whose ambient Node is older than 22.13, the action downloads standalone `@pnpm/exe`, which has repeatedly taken several minutes. Supplying Node 24 first lets the same pinned pnpm action use its normal Node-backed path. ## What Changed - install Node 24 before every trusted `pnpm/action-setup` invocation - preserve the existing pnpm-store cache setup, pinned actions, telemetry suppression, conditions, and secret boundaries - enforce ordering, modern Node, condition parity, and cache counts in the workflow security contract ## Verification - workflow security: 7/7 - Prettier - actionlint (excluding one pre-existing SC2129 in an untouched Daytona shell block) - `git diff --check` ## Risks Low. Product code, providers, paid-runner selection, credentials, and pnpm version are unchanged. Jobs that restore pnpm cache run `setup-node` a second time after pnpm becomes available; the first setup is deliberately cache-free. ## Model Used Codex (GPT-5)
This commit is contained in:
1 parent
18ea965442
commit
a0a78ee609
3 files changed
+116
-12
No files matched your search
@@ -45,6 +45,58 @@ describe("public repository paid workflow security", () => {
|
||||
}
|
||||
});
|
||||
|
||||
it("installs a modern Node runtime before every trusted pnpm bootstrap", async () => {
|
||||
const workflows = [
|
||||
{
|
||||
name: "runner-full-stack-e2e.yml",
|
||||
expectedCachedSetupNodeSteps: 4,
|
||||
},
|
||||
{
|
||||
name: "pr-trusted.yml",
|
||||
expectedCachedSetupNodeSteps: 7,
|
||||
},
|
||||
];
|
||||
|
||||
for (const { name, expectedCachedSetupNodeSteps } of workflows) {
|
||||
const workflow = await readFile(
|
||||
path.join(repositoryRoot, ".github/workflows", name),
|
||||
"utf8",
|
||||
);
|
||||
const steps = workflow.split(/\n(?= {6}- )/u);
|
||||
const pnpmSetupStepIndexes = steps.flatMap((step, index) =>
|
||||
step.includes("uses: pnpm/action-setup@") ? [index] : [],
|
||||
);
|
||||
|
||||
expect(pnpmSetupStepIndexes, name).toHaveLength(7);
|
||||
for (const pnpmSetupStepIndex of pnpmSetupStepIndexes) {
|
||||
const pnpmSetupStep = steps[pnpmSetupStepIndex]!;
|
||||
const nodeBootstrapStep = steps[pnpmSetupStepIndex - 1]!;
|
||||
expect(nodeBootstrapStep, name).toContain("uses: actions/setup-node@");
|
||||
expect(nodeBootstrapStep, name).not.toContain("cache: pnpm");
|
||||
|
||||
const nodeVersionMatch = nodeBootstrapStep.match(
|
||||
/^\s*node-version:\s*["']?(\d+)(?:\.(\d+))?/mu,
|
||||
);
|
||||
expect(nodeVersionMatch, name).not.toBeNull();
|
||||
const nodeMajor = Number(nodeVersionMatch![1]);
|
||||
const nodeMinor = Number(nodeVersionMatch![2] ?? 0);
|
||||
expect(
|
||||
nodeMajor > 22 || (nodeMajor === 22 && nodeMinor >= 13),
|
||||
`${name} must install Node >=22.13 before pnpm/action-setup`,
|
||||
).toBe(true);
|
||||
|
||||
const conditionPattern = /^ {6}- if:\s*(.+)$/mu;
|
||||
expect(nodeBootstrapStep.match(conditionPattern)?.[1] ?? null).toBe(
|
||||
pnpmSetupStep.match(conditionPattern)?.[1] ?? null,
|
||||
);
|
||||
}
|
||||
|
||||
expect(workflow.match(/^\s+cache: pnpm$/gmu), name).toHaveLength(
|
||||
expectedCachedSetupNodeSteps,
|
||||
);
|
||||
}
|
||||
});
|
||||
|
||||
it("gates every provider-secret job with stable actor IDs", async () => {
|
||||
const workflows = await Promise.all(
|
||||
["runner-full-stack-e2e.yml", "runner-live-evals.yml", "e2e.yml"].map(
|
||||
|
||||
Reference in new issue
Block a user