fix(release): overlay plugin lock generator (#117677)

This commit is contained in:
Vincent Koc
2026-08-02 08:58:55 +08:00
committed by GitHub
parent d69dba245b
commit 9bc3c29555
2 changed files with 37 additions and 2 deletions
+10 -1
View File
@@ -9,6 +9,7 @@ on:
- ".github/workflows/plugin-npm-release.yml"
- "extensions/**"
- "package.json"
- "scripts/generate-npm-package-lock.mjs"
- "scripts/lib/npm-publish-plan.mjs"
- "scripts/lib/release-version.mjs"
- "scripts/lib/plugin-npm-package-manifest.mjs"
@@ -335,12 +336,17 @@ jobs:
ref: ${{ github.workflow_sha }}
path: .release-tooling
fetch-depth: 1
sparse-checkout: scripts/lib/plugin-npm-package-manifest.mjs
sparse-checkout: |
scripts/generate-npm-package-lock.mjs
scripts/lib/plugin-npm-package-manifest.mjs
sparse-checkout-cone-mode: false
- name: Overlay trusted packaging helper
run: |
set -euo pipefail
cp \
.release-tooling/scripts/generate-npm-package-lock.mjs \
scripts/generate-npm-package-lock.mjs
cp \
.release-tooling/scripts/lib/plugin-npm-package-manifest.mjs \
scripts/lib/plugin-npm-package-manifest.mjs
@@ -1229,6 +1235,9 @@ jobs:
if: steps.publication_evidence.outputs.publish_route == 'npm-oidc'
run: |
set -euo pipefail
cp \
scripts/generate-npm-package-lock.mjs \
.publication-target/scripts/generate-npm-package-lock.mjs
cp \
scripts/lib/plugin-npm-package-manifest.mjs \
.publication-target/scripts/lib/plugin-npm-package-manifest.mjs
@@ -105,6 +105,33 @@ describe("plugin npm extended-stable workflow", () => {
}
});
it("overlays the complete trusted packaging helper dependency pair", () => {
const parsed = workflow();
const preflightCheckout = step(
parsed.jobs?.preview_plugin_pack,
"Checkout trusted packaging helper",
);
expect(preflightCheckout.with?.["sparse-checkout"]).toContain(
"scripts/generate-npm-package-lock.mjs",
);
expect(preflightCheckout.with?.["sparse-checkout"]).toContain(
"scripts/lib/plugin-npm-package-manifest.mjs",
);
const expectedCopies = [
"scripts/generate-npm-package-lock.mjs",
"scripts/lib/plugin-npm-package-manifest.mjs",
];
for (const helperPath of expectedCopies) {
expect(
step(parsed.jobs?.preview_plugin_pack, "Overlay trusted packaging helper").run,
).toContain(helperPath);
expect(
step(parsed.jobs?.publish_plugins_npm, "Overlay trusted OIDC packaging helper").run,
).toContain(helperPath);
}
});
it("trusts only the canonical monthly branch at the exact checked-out SHA", () => {
const trusted = step(
workflow().jobs?.preview_plugins_npm,
@@ -404,7 +431,6 @@ describe("plugin npm extended-stable workflow", () => {
).toMatchObject({
ref: "${{ github.workflow_sha }}",
path: ".release-tooling",
"sparse-checkout": "scripts/lib/plugin-npm-package-manifest.mjs",
});
expect(
step(parsed.jobs?.preview_plugin_pack, "Overlay trusted packaging helper").run,