Skip to content
Merged
Show file tree
Hide file tree
Changes from all 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
1 change: 1 addition & 0 deletions .github/actions/lint-docs/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ runs:
- uses: pnpm/action-setup@b906affcce14559ad1aafd4ab0e942779e9f58b1 # v4
with:
version: 10.16.1
package_json_file: .volcano-docs-lint/no-package.json

- uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4.4.0
with:
Expand Down
3 changes: 3 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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"
},
Expand Down
26 changes: 26 additions & 0 deletions scripts/lint-docs-action.test.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
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),
"utf8",
);
const setup = action.match(
/- uses: pnpm\/action-setup@[^\n]+\n(?<inputs>(?: {6,}.+\n)*)/,
);
const packageJson = JSON.parse(
await readFile(new URL("../package.json", import.meta.url), "utf8"),
);

assert.ok(setup, "lint action must install pnpm");
const version = setup.groups.inputs.match(/^ {8}version: (?<value>\S+)$/m);
const manifest = setup.groups.inputs.match(
/^ {8}package_json_file: (?<value>\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);
Loading