Skip to content

Commit e767c71

Browse files
committed
fix(ci): review action pins with the publish contract
1 parent 25a3b6e commit e767c71

3 files changed

Lines changed: 27 additions & 1 deletion

File tree

‎RELEASING.md‎

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -182,6 +182,17 @@ Responses streams. It never contacts the production API.
182182
validate every workflow. It is not a GitHub Actions emulator and does not prove
183183
that any workflow executed remotely.
184184

185+
Action updates that touch `publish.yml` require a coordinated review of the
186+
upstream commits and the resulting executable workflow. After that review,
187+
update `PUBLISH_WORKFLOW_CONTRACT_SHA256` in
188+
`scripts/release-workflow-validation.mjs` in the same pull request as the action
189+
pins, then run `npm run verify`. The fingerprint is the SHA-256 of
190+
`JSON.stringify(parse(publishYaml))`, using the repository's `yaml` package.
191+
Dependabot cannot perform this review or update the fingerprint. Repeated
192+
rebases or reruns of an action-only pull request will therefore keep failing;
193+
finish the coordinated update before merging it. Preserve the negative tests
194+
for unreviewed action commits, permissions, gates, and publication commands.
195+
185196
## Version and dist-tag agreement
186197

187198
`package.json` is the sole candidate-version authority; validation must not

‎scripts/release-workflow-validation.mjs‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ const RELEASE_WORKFLOW_STEP = "Run Release Please";
1818
const PUBLISH_OPERATION = "release";
1919
const NPM_TAG_POLICY_ID = 55718965;
2020
const PUBLISH_WORKFLOW_CONTRACT_SHA256 =
21-
"379ba8678416ff96d3bcf220a23e8602d2b55890164b2847331def10b4e99693";
21+
"98910174abd3fc5a1d7e8c0cb64efb717960d54557e9799beea39a6228ef4bac";
2222
const PUBLISH_HANDOFF_IF =
2323
"vars.RELEASE_PLEASE_ENABLED == 'true' && github.event_name == 'workflow_run' && github.run_attempt == 1 && github.event.workflow_run.conclusion == 'success' && github.event.workflow_run.event == 'push' && github.event.workflow_run.head_branch == 'main'";
2424
const PUBLISH_RESULT_IF = "steps.result.outputs.has-result == 'true'";

‎tests/release-workflow-validation.test.mjs‎

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -368,6 +368,21 @@ describe("Publish workflow dispatch contract", () => {
368368
});
369369
});
370370

371+
it.each([
372+
"actions/setup-node",
373+
"actions/upload-artifact",
374+
"actions/download-artifact",
375+
])("rejects an unreviewed %s commit", (action) => {
376+
const workflow = workflowContract();
377+
const step = Object.values(workflow.jobs)
378+
.flatMap((job) => job.steps)
379+
.find((candidate) => candidate.uses?.startsWith(`${action}@`));
380+
step.uses = `${action}@${"a".repeat(40)}`;
381+
expect(() => validatePublishWorkflowContract(workflow)).toThrow(
382+
/Publish executable definition digest/,
383+
);
384+
});
385+
371386
it.each([
372387
[
373388
"optional control input",

0 commit comments

Comments
 (0)