From fbef5426d4db987d7112b2bfd1a701bb78dd5128 Mon Sep 17 00:00:00 2001 From: Sean Keever <33592180+swkeever@users.noreply.github.com> Date: Thu, 27 Aug 2026 10:19:09 -0400 Subject: [PATCH 1/2] fix(ci): isolate docs lint pnpm version --- .github/actions/lint-docs/action.yml | 2 +- .github/workflows/ci.yml | 3 +++ package.json | 1 + scripts/lint-docs-action.test.mjs | 22 ++++++++++++++++++++++ 4 files changed, 27 insertions(+), 1 deletion(-) create mode 100644 scripts/lint-docs-action.test.mjs diff --git a/.github/actions/lint-docs/action.yml b/.github/actions/lint-docs/action.yml index 8a1d5ef..b117716 100644 --- a/.github/actions/lint-docs/action.yml +++ b/.github/actions/lint-docs/action.yml @@ -11,7 +11,7 @@ runs: steps: - uses: pnpm/action-setup@b906affcce14559ad1aafd4ab0e942779e9f58b1 # v4 with: - version: 10.16.1 + package_json_file: ${{ github.action_path }}/../../../package.json - uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4.4.0 with: diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 2b83800..ef06636 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -36,5 +36,8 @@ jobs: - name: Check links and routes run: pnpm check:links + - name: Test reusable actions + run: pnpm test:actions + - name: Build run: pnpm build diff --git a/package.json b/package.json index b03c9fd..27ecfc2 100644 --- a/package.json +++ b/package.json @@ -16,6 +16,7 @@ "lint:docs": "node scripts/lint-docs.mjs", "check:links": "node scripts/check-links.mjs content public", "check:search-index": "node scripts/check-search-index.mjs", + "test:actions": "node scripts/lint-docs-action.test.mjs", "verify": "node src/lib/relative-md-href.test.mjs && node scripts/lint-docs.mjs content && node scripts/check-links.mjs content public && pnpm build", "migrate:docs": "node scripts/migrate-docs.mjs" }, diff --git a/scripts/lint-docs-action.test.mjs b/scripts/lint-docs-action.test.mjs new file mode 100644 index 0000000..cb6f935 --- /dev/null +++ b/scripts/lint-docs-action.test.mjs @@ -0,0 +1,22 @@ +import assert from "node:assert/strict"; +import { readFile } from "node:fs/promises"; + +const action = await readFile( + new URL("../.github/actions/lint-docs/action.yml", import.meta.url), + "utf8", +); +const setup = action.match( + /- uses: pnpm\/action-setup@[^\n]+\n(?(?: {6,}.+\n)*)/, +); + +assert.ok(setup, "lint action must install pnpm"); +assert.doesNotMatch( + setup.groups.inputs, + /^ {8}version:/m, + "lint action must not force a pnpm version over the caller package", +); +assert.match( + setup.groups.inputs, + /^ {8}package_json_file: \$\{\{ github\.action_path \}\}\/\.\.\/\.\.\/\.\.\/package\.json$/m, + "lint action must resolve pnpm from volcano-docs", +); From 1d3b789edd3afe501fb59605778cd42a8aaf132c Mon Sep 17 00:00:00 2001 From: Sean Keever <33592180+swkeever@users.noreply.github.com> Date: Thu, 27 Aug 2026 10:26:10 -0400 Subject: [PATCH 2/2] fix(ci): isolate caller package metadata --- .github/actions/lint-docs/action.yml | 3 ++- scripts/lint-docs-action.test.mjs | 22 +++++++++++++--------- 2 files changed, 15 insertions(+), 10 deletions(-) diff --git a/.github/actions/lint-docs/action.yml b/.github/actions/lint-docs/action.yml index b117716..a4fe6e1 100644 --- a/.github/actions/lint-docs/action.yml +++ b/.github/actions/lint-docs/action.yml @@ -11,7 +11,8 @@ runs: steps: - uses: pnpm/action-setup@b906affcce14559ad1aafd4ab0e942779e9f58b1 # v4 with: - package_json_file: ${{ github.action_path }}/../../../package.json + version: 10.16.1 + package_json_file: .volcano-docs-lint/no-package.json - uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4.4.0 with: diff --git a/scripts/lint-docs-action.test.mjs b/scripts/lint-docs-action.test.mjs index cb6f935..8c9b805 100644 --- a/scripts/lint-docs-action.test.mjs +++ b/scripts/lint-docs-action.test.mjs @@ -1,5 +1,6 @@ import assert from "node:assert/strict"; import { readFile } from "node:fs/promises"; +import path from "node:path"; const action = await readFile( new URL("../.github/actions/lint-docs/action.yml", import.meta.url), @@ -8,15 +9,18 @@ const action = await readFile( const setup = action.match( /- uses: pnpm\/action-setup@[^\n]+\n(?(?: {6,}.+\n)*)/, ); +const packageJson = JSON.parse( + await readFile(new URL("../package.json", import.meta.url), "utf8"), +); assert.ok(setup, "lint action must install pnpm"); -assert.doesNotMatch( - setup.groups.inputs, - /^ {8}version:/m, - "lint action must not force a pnpm version over the caller package", -); -assert.match( - setup.groups.inputs, - /^ {8}package_json_file: \$\{\{ github\.action_path \}\}\/\.\.\/\.\.\/\.\.\/package\.json$/m, - "lint action must resolve pnpm from volcano-docs", +const version = setup.groups.inputs.match(/^ {8}version: (?\S+)$/m); +const manifest = setup.groups.inputs.match( + /^ {8}package_json_file: (?\S+)$/m, ); + +assert.ok(version, "lint action must pin pnpm explicitly"); +assert.equal(`pnpm@${version.groups.value}`, packageJson.packageManager); +assert.ok(manifest, "lint action must isolate caller package metadata"); +assert.equal(manifest.groups.value, ".volcano-docs-lint/no-package.json"); +assert.equal(path.isAbsolute(manifest.groups.value), false);