fix(ci): check authored documentation code

Co-authored-by: Kaoru0822 <208281322+kaoru0822-kitauji@users.noreply.github.com>
This commit is contained in:
N0zoM1z0 2026-10-14 03:23:37 +00:00
parent f3534749e5
commit eeafead333
2 changed files with 35 additions and 1 deletions

View File

@ -175,6 +175,8 @@ if (tier === "reused") {
file.startsWith(".github/ISSUE_TEMPLATE/")
) {
selected.docs = true;
// Authored documentation code also belongs to the static checkers.
selected.code ||= /^docs\/.*\.(?:[cm]?[jt]s|[jt]sx)$/u.test(file);
selected.website ||= matchesAny(file, SCOPES.website);
continue;
}

View File

@ -144,6 +144,38 @@ it("keeps every translated README and authored guide on the documentation lane",
});
});
it.each(["cjs", "cts", "js", "jsx", "mjs", "mts", "ts", "tsx"])(
"selects static checks for authored documentation code (%s) without provider lanes",
async (extension) => {
const { directory, base } = await fixture();
const head = await change(directory, [
`docs/.vitepress/helpers/navigation.${extension}`,
]);
const plan = await classify(directory, base, head);
const { CI_FLAGS } = await loadScopes();
expect(plan).toMatchObject({ tier: "fast", code: true, docs: true });
for (const flag of CI_FLAGS)
if (flag !== "code" && flag !== "docs") expect(plan[flag]).toBe(false);
},
);
it("retains code checks when documentation code is removed or renamed to Markdown", async () => {
const { directory } = await fixture();
const base = await change(directory, ["docs/.vitepress/config.ts"]);
await git(directory, [
"mv",
"docs/.vitepress/config.ts",
"docs/configuration.md",
]);
const head = await commit(directory);
expect(await classify(directory, base, head)).toMatchObject({
code: true,
docs: true,
runtime: false,
package: false,
});
});
it.each([
"job-timings.mjs",
"job-timings-batch.mjs",
@ -937,7 +969,7 @@ it.each([
"tsconfig.build.json",
{ code: true, package: true, browser: true, evm: true },
],
["docs/.vitepress/config.ts", { code: false, docs: true, package: false }],
["docs/.vitepress/config.ts", { code: true, docs: true, package: false }],
["CHANGELOG.md", { code: false, docs: true, package: false }],
["SECURITY.md", { code: false, docs: true, package: false }],
[".github/pull_request_template.md", { code: false, docs: true }],