@mark1russell7/conventions 0.41.15 → 0.42.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -0
- package/build/cli.js +1 -1
- package/build/index.d.ts +1 -0
- package/build/index.d.ts.map +1 -1
- package/build/index.js +2 -2
- package/build/{run-B0C25xmx.js → run-B9bgU10k.js} +414 -17
- package/build/run-B9bgU10k.js.map +1 -0
- package/package.json +2 -2
- package/build/run-B0C25xmx.js.map +0 -1
|
@@ -2219,6 +2219,7 @@ const SHARED_WORKFLOWS = [
|
|
|
2219
2219
|
"reusable-codex-review.yml",
|
|
2220
2220
|
"reusable-lockfile.yml",
|
|
2221
2221
|
"reusable-mutation.yml",
|
|
2222
|
+
"reusable-pages-check.yml",
|
|
2222
2223
|
"reusable-pages.yml",
|
|
2223
2224
|
"reusable-queue.yml",
|
|
2224
2225
|
"reusable-release-build.yml",
|
|
@@ -2236,12 +2237,14 @@ const SHARED_ACTIONS = [
|
|
|
2236
2237
|
"gate-summary",
|
|
2237
2238
|
"green-main",
|
|
2238
2239
|
"npm-publish",
|
|
2240
|
+
"pages-build",
|
|
2239
2241
|
"pull-of-run",
|
|
2240
2242
|
"release-check",
|
|
2241
2243
|
"security-scan",
|
|
2242
2244
|
"setup-cue",
|
|
2243
2245
|
"setup-playwright",
|
|
2244
2246
|
"site-check",
|
|
2247
|
+
"site-config",
|
|
2245
2248
|
"site-pages"
|
|
2246
2249
|
];
|
|
2247
2250
|
/** The `uses` value of a job that calls the shared CI, with no pin. */
|
|
@@ -11952,7 +11955,7 @@ const COVERAGE_PROVIDER = "@vitest/coverage-v8";
|
|
|
11952
11955
|
/** The `uses` value of a job that calls the shared CI, from another repository or from the template itself. */
|
|
11953
11956
|
const SHARED_CI_CALL = /^(?:mark1russell7\/template\/|\.\/)\.github\/workflows\/reusable-ci\.ya?ml(?:@|$)/;
|
|
11954
11957
|
/** This function gives the id of the key of a line of YAML. */
|
|
11955
|
-
const keyOf$
|
|
11958
|
+
const keyOf$2 = (line) => {
|
|
11956
11959
|
const text = line.trim();
|
|
11957
11960
|
const colon = text.indexOf(":");
|
|
11958
11961
|
return (colon < 0 ? text : text.slice(0, colon)).replace(/^["']|["']$/g, "");
|
|
@@ -11968,9 +11971,9 @@ function coverageInputs(text) {
|
|
|
11968
11971
|
const uses = keys.map((at) => keyValue(lines[at] ?? "", "uses")).find((value) => value !== void 0);
|
|
11969
11972
|
if (uses === void 0 || !SHARED_CI_CALL.test(uses)) continue;
|
|
11970
11973
|
const inputs = /* @__PURE__ */ new Map();
|
|
11971
|
-
const block = keys.find((at) => keyOf$
|
|
11974
|
+
const block = keys.find((at) => keyOf$2(lines[at] ?? "") === "with");
|
|
11972
11975
|
for (const at of block === void 0 ? [] : childKeys(lines, block)) {
|
|
11973
|
-
const name = keyOf$
|
|
11976
|
+
const name = keyOf$2(lines[at] ?? "");
|
|
11974
11977
|
inputs.set(name, (keyValue(lines[at] ?? "", name) ?? "").replace(/^["']|["']$/g, ""));
|
|
11975
11978
|
}
|
|
11976
11979
|
found.push({
|
|
@@ -13428,7 +13431,7 @@ const pagesSite = {
|
|
|
13428
13431
|
id: "pages-site",
|
|
13429
13432
|
title: "A public repository has a workflow that calls the Pages workflow of the template (`reusable-pages.yml`, any ref), and the call deploys.",
|
|
13430
13433
|
reason: "Each public project has a site with its Releases page and its Status page, so a reader sees the versions and the open work. On 2026-11-02 eight public repositories had no site: typeset, algebra, headroom, release-train, optional, ste-lint, lag-hud and template.",
|
|
13431
|
-
fix: "Add `.github/workflows/pages.yml` with a job `uses: mark1russell7/template/.github/workflows/reusable-pages.yml@<commit> # main` and the permissions of CI.md (\"Pages\").
|
|
13434
|
+
fix: "Add `.github/workflows/pages.yml` with a job `uses: mark1russell7/template/.github/workflows/reusable-pages.yml@<commit> # main` and the permissions of CI.md (\"Pages\"). Put `build`, `out` and `roadmap` in `.github/site.json` (CI.md, \"The site config\"). After the build, the job starts `site-pages build`, which adds the Releases page and the Status page. Then set the Pages source to \"GitHub Actions\": `gh api -X POST repos/<owner>/<repo>/pages -f build_type=workflow`.",
|
|
13432
13435
|
sources: [
|
|
13433
13436
|
"vex",
|
|
13434
13437
|
"crawler",
|
|
@@ -13538,7 +13541,7 @@ function flowEntry(part) {
|
|
|
13538
13541
|
};
|
|
13539
13542
|
}
|
|
13540
13543
|
/** This function gives the key and the value of a line of a block. */
|
|
13541
|
-
function keyOf(line) {
|
|
13544
|
+
function keyOf$1(line) {
|
|
13542
13545
|
const found = KEY.exec(line);
|
|
13543
13546
|
if (found === null) return void 0;
|
|
13544
13547
|
return {
|
|
@@ -13575,7 +13578,7 @@ function readTriggers(lines) {
|
|
|
13575
13578
|
};
|
|
13576
13579
|
}
|
|
13577
13580
|
const list = childKeys(lines, on).flatMap((at) => {
|
|
13578
|
-
const entry = keyOf(lines[at] ?? "");
|
|
13581
|
+
const entry = keyOf$1(lines[at] ?? "");
|
|
13579
13582
|
return entry === void 0 ? [] : [{
|
|
13580
13583
|
name: entry.key,
|
|
13581
13584
|
at,
|
|
@@ -13644,7 +13647,7 @@ function filtersOf(lines, trigger) {
|
|
|
13644
13647
|
}
|
|
13645
13648
|
if (trigger.value !== "") return [];
|
|
13646
13649
|
return childKeys(lines, trigger.at).flatMap((at) => {
|
|
13647
|
-
const entry = keyOf(lines[at] ?? "");
|
|
13650
|
+
const entry = keyOf$1(lines[at] ?? "");
|
|
13648
13651
|
if (entry === void 0) return [];
|
|
13649
13652
|
const list = listItems(lines, at, entry.value);
|
|
13650
13653
|
if (list !== void 0) return [{
|
|
@@ -14329,6 +14332,357 @@ const pagesAfterRelease = {
|
|
|
14329
14332
|
return breaks;
|
|
14330
14333
|
}
|
|
14331
14334
|
};
|
|
14335
|
+
// ../site-pages/src/config/site-config.ts
|
|
14336
|
+
/**
|
|
14337
|
+
* The site config of a repository: the one home of the inputs of its site build (CI.md, "The site config").
|
|
14338
|
+
*
|
|
14339
|
+
* The file `.github/site.json` of the repository holds them. `reusable-pages.yml` (build and deploy) and
|
|
14340
|
+
* `reusable-pages-check.yml` (the check of a pull request) read it with `main.ts` of this folder. Thus the two
|
|
14341
|
+
* workflows build the same site, and each value has one home. The rules of `@mark1russell7/conventions` read it too.
|
|
14342
|
+
*
|
|
14343
|
+
* A repository with no file gives the old inputs of `reusable-pages.yml`, and the resolver takes them. Thus an old
|
|
14344
|
+
* caller keeps its site. A repository that has the file and also gives a site input gets an error.
|
|
14345
|
+
*
|
|
14346
|
+
* In each string value, `{owner}` is the owner of the repository and `{repo}` is its name. This file imports nothing,
|
|
14347
|
+
* so the workflow starts it from the template commit with no install.
|
|
14348
|
+
*/
|
|
14349
|
+
/** The path of the site config in a repository. */
|
|
14350
|
+
const SITE_CONFIG_PATH = ".github/site.json";
|
|
14351
|
+
/** The keys of the site config, with their types and their defaults. */
|
|
14352
|
+
const SITE_CONFIG_KEYS = {
|
|
14353
|
+
build: {
|
|
14354
|
+
kind: "string",
|
|
14355
|
+
default: ""
|
|
14356
|
+
},
|
|
14357
|
+
out: {
|
|
14358
|
+
kind: "string",
|
|
14359
|
+
default: ""
|
|
14360
|
+
},
|
|
14361
|
+
env: {
|
|
14362
|
+
kind: "env",
|
|
14363
|
+
default: {}
|
|
14364
|
+
},
|
|
14365
|
+
"github-token": {
|
|
14366
|
+
kind: "boolean",
|
|
14367
|
+
default: false
|
|
14368
|
+
},
|
|
14369
|
+
"node-version": {
|
|
14370
|
+
kind: "string",
|
|
14371
|
+
default: "26"
|
|
14372
|
+
},
|
|
14373
|
+
"node-version-file": {
|
|
14374
|
+
kind: "string",
|
|
14375
|
+
default: ""
|
|
14376
|
+
},
|
|
14377
|
+
"site-pages": {
|
|
14378
|
+
kind: "boolean",
|
|
14379
|
+
default: true
|
|
14380
|
+
},
|
|
14381
|
+
"site-pages-version": {
|
|
14382
|
+
kind: "string",
|
|
14383
|
+
default: ""
|
|
14384
|
+
},
|
|
14385
|
+
roadmap: {
|
|
14386
|
+
kind: "string",
|
|
14387
|
+
default: ""
|
|
14388
|
+
},
|
|
14389
|
+
base: {
|
|
14390
|
+
kind: "string",
|
|
14391
|
+
default: ""
|
|
14392
|
+
},
|
|
14393
|
+
packages: {
|
|
14394
|
+
kind: "string",
|
|
14395
|
+
default: ""
|
|
14396
|
+
},
|
|
14397
|
+
changesets: {
|
|
14398
|
+
kind: "string",
|
|
14399
|
+
default: ""
|
|
14400
|
+
},
|
|
14401
|
+
group: {
|
|
14402
|
+
kind: "string",
|
|
14403
|
+
default: ""
|
|
14404
|
+
},
|
|
14405
|
+
css: {
|
|
14406
|
+
kind: "string",
|
|
14407
|
+
default: ""
|
|
14408
|
+
},
|
|
14409
|
+
"site-name": {
|
|
14410
|
+
kind: "string",
|
|
14411
|
+
default: ""
|
|
14412
|
+
},
|
|
14413
|
+
"data-only": {
|
|
14414
|
+
kind: "boolean",
|
|
14415
|
+
default: false
|
|
14416
|
+
},
|
|
14417
|
+
"data-stamps": {
|
|
14418
|
+
kind: "string",
|
|
14419
|
+
default: ""
|
|
14420
|
+
},
|
|
14421
|
+
"site-check": {
|
|
14422
|
+
kind: "boolean",
|
|
14423
|
+
default: false
|
|
14424
|
+
},
|
|
14425
|
+
"site-check-pages": {
|
|
14426
|
+
kind: "string",
|
|
14427
|
+
default: ""
|
|
14428
|
+
},
|
|
14429
|
+
"site-check-widths": {
|
|
14430
|
+
kind: "string",
|
|
14431
|
+
default: ""
|
|
14432
|
+
},
|
|
14433
|
+
"site-check-probe": {
|
|
14434
|
+
kind: "string",
|
|
14435
|
+
default: ""
|
|
14436
|
+
},
|
|
14437
|
+
"site-check-playwright": {
|
|
14438
|
+
kind: "string",
|
|
14439
|
+
default: "1.64.1"
|
|
14440
|
+
},
|
|
14441
|
+
"site-bar": {
|
|
14442
|
+
kind: "boolean",
|
|
14443
|
+
default: false
|
|
14444
|
+
},
|
|
14445
|
+
"site-bar-pages": {
|
|
14446
|
+
kind: "string",
|
|
14447
|
+
default: ""
|
|
14448
|
+
},
|
|
14449
|
+
"site-bar-npm": {
|
|
14450
|
+
kind: "string",
|
|
14451
|
+
default: ""
|
|
14452
|
+
},
|
|
14453
|
+
"scroll-cue": {
|
|
14454
|
+
kind: "boolean",
|
|
14455
|
+
default: true
|
|
14456
|
+
},
|
|
14457
|
+
"indexnow-key": {
|
|
14458
|
+
kind: "string",
|
|
14459
|
+
default: ""
|
|
14460
|
+
}
|
|
14461
|
+
};
|
|
14462
|
+
const NAME = /^[A-Za-z_][A-Za-z0-9_]*$/;
|
|
14463
|
+
/** This function puts the owner and the name of the repository in for {owner} and {repo}. */
|
|
14464
|
+
function fillRepository(value, repository) {
|
|
14465
|
+
const [owner = "", repo = ""] = repository.split("/");
|
|
14466
|
+
return value.replaceAll("{owner}", owner).replaceAll("{repo}", repo);
|
|
14467
|
+
}
|
|
14468
|
+
/** This function checks one value against the type of its key, and gives the value or an error. */
|
|
14469
|
+
function check(key, value, where, repository) {
|
|
14470
|
+
const kind = SITE_CONFIG_KEYS[key].kind;
|
|
14471
|
+
if (kind === "boolean") return typeof value === "boolean" ? { value } : { error: `${where}: "${key}" must be true or false.` };
|
|
14472
|
+
if (kind === "string") return typeof value === "string" ? { value: fillRepository(value, repository) } : { error: `${where}: "${key}" must be a string.` };
|
|
14473
|
+
if (value === null || typeof value !== "object" || Array.isArray(value)) return { error: `${where}: "env" must be an object of strings.` };
|
|
14474
|
+
const env = {};
|
|
14475
|
+
for (const [name, text] of Object.entries(value)) {
|
|
14476
|
+
if (!NAME.test(name)) return { error: `${where}: "${name}" of "env" is not a name of an environment variable.` };
|
|
14477
|
+
if (typeof text !== "string") return { error: `${where}: the value of "${name}" of "env" must be a string.` };
|
|
14478
|
+
env[name] = fillRepository(text, repository);
|
|
14479
|
+
}
|
|
14480
|
+
return { value: env };
|
|
14481
|
+
}
|
|
14482
|
+
/**
|
|
14483
|
+
* This function gives the keys of the site config that the inputs of a workflow give with a value other than the default.
|
|
14484
|
+
* The input `env` of `reusable-pages.yml` is a JSON string, and `"{}"` or an empty string is its default.
|
|
14485
|
+
*/
|
|
14486
|
+
function inputsGiven(inputs) {
|
|
14487
|
+
return Object.keys(SITE_CONFIG_KEYS).filter((key) => {
|
|
14488
|
+
const value = inputs[key];
|
|
14489
|
+
if (value === void 0) return false;
|
|
14490
|
+
if (key === "env") return !(value === "" || typeof value === "string" && value.replace(/\s/g, "") === "{}");
|
|
14491
|
+
return value !== SITE_CONFIG_KEYS[key].default;
|
|
14492
|
+
});
|
|
14493
|
+
}
|
|
14494
|
+
/**
|
|
14495
|
+
* This function gives the site config of a repository from its file, or from the old inputs when it has no file. The
|
|
14496
|
+
* workflow uses only the file. Thus a repository with the file gets an error for a site input that is not its default.
|
|
14497
|
+
*/
|
|
14498
|
+
function resolveSiteConfig(input) {
|
|
14499
|
+
const config = Object.fromEntries(Object.entries(SITE_CONFIG_KEYS).map(([key, spec]) => [key, spec.default]));
|
|
14500
|
+
let source;
|
|
14501
|
+
if (input.file !== void 0) {
|
|
14502
|
+
const given = input.inputs === void 0 ? [] : inputsGiven(input.inputs);
|
|
14503
|
+
if (given.length > 0) return { error: `The repository has ${input.path} and the workflow also gives the inputs ${given.join(", ")}. Give the site values only in ${input.path}.` };
|
|
14504
|
+
let data;
|
|
14505
|
+
try {
|
|
14506
|
+
data = JSON.parse(input.file);
|
|
14507
|
+
} catch (error) {
|
|
14508
|
+
return { error: `${input.path} is not JSON: ${error.message}` };
|
|
14509
|
+
}
|
|
14510
|
+
if (data === null || typeof data !== "object" || Array.isArray(data)) return { error: `${input.path} must be a JSON object.` };
|
|
14511
|
+
for (const [key, value] of Object.entries(data)) {
|
|
14512
|
+
if (key === "$schema" || key === "$comment") continue;
|
|
14513
|
+
if (!Object.hasOwn(SITE_CONFIG_KEYS, key)) return { error: `${input.path}: "${key}" is not a key of the site config. CI.md tells the keys.` };
|
|
14514
|
+
const checked = check(key, value, input.path, input.repository);
|
|
14515
|
+
if ("error" in checked) return checked;
|
|
14516
|
+
config[key] = checked.value;
|
|
14517
|
+
}
|
|
14518
|
+
source = "file";
|
|
14519
|
+
} else if (input.inputs !== void 0) {
|
|
14520
|
+
for (const key of Object.keys(SITE_CONFIG_KEYS)) {
|
|
14521
|
+
let value = input.inputs[key];
|
|
14522
|
+
if (value === void 0) continue;
|
|
14523
|
+
if (key === "env") {
|
|
14524
|
+
if (value === "") continue;
|
|
14525
|
+
try {
|
|
14526
|
+
value = JSON.parse(String(value));
|
|
14527
|
+
} catch (error) {
|
|
14528
|
+
return { error: `The input env is not JSON: ${error.message}` };
|
|
14529
|
+
}
|
|
14530
|
+
}
|
|
14531
|
+
const checked = check(key, value, "the inputs", input.repository);
|
|
14532
|
+
if ("error" in checked) return checked;
|
|
14533
|
+
config[key] = checked.value;
|
|
14534
|
+
}
|
|
14535
|
+
source = "inputs";
|
|
14536
|
+
} else return { error: `The repository has no ${input.path}. The check of the site needs the file (CI.md, "The site config").` };
|
|
14537
|
+
for (const key of ["build", "out"]) if (config[key] === "") return { error: `${source === "file" ? input.path : "the inputs of the workflow"} gives no "${key}". The site config needs "build" and "out".` };
|
|
14538
|
+
return {
|
|
14539
|
+
config,
|
|
14540
|
+
source
|
|
14541
|
+
};
|
|
14542
|
+
}
|
|
14543
|
+
// src/rules/site-check-in-ci.ts
|
|
14544
|
+
/**
|
|
14545
|
+
* The rule `site-check-in-ci`: a repository that deploys a site with the Pages workflow checks the same site on each
|
|
14546
|
+
* pull request. The check `CI OK` needs the job of this check. The site values are in `.github/site.json`, and the deploy
|
|
14547
|
+
* starts on no pull request, directly or through a call.
|
|
14548
|
+
*/
|
|
14549
|
+
/** The check workflow of the template, as a call from another repository and as a call from the template itself. */
|
|
14550
|
+
const CHECK_WORKFLOWS = ["mark1russell7/template/.github/workflows/reusable-pages-check.yml", "./.github/workflows/reusable-pages-check.yml"];
|
|
14551
|
+
/** The events of a pull request. A job of such an event must not get a write permission. */
|
|
14552
|
+
const PULL_REQUEST = /* @__PURE__ */ new Set(["pull_request", "pull_request_target"]);
|
|
14553
|
+
/** This function gives the key of a line with no quotes. A list item (`- push`) gives its value. */
|
|
14554
|
+
function keyOf(line) {
|
|
14555
|
+
let text = line.trimStart();
|
|
14556
|
+
if (text.startsWith("- ")) text = text.slice(2).trimStart();
|
|
14557
|
+
const colon = text.indexOf(":");
|
|
14558
|
+
return valueOf$1(colon < 0 ? text : text.slice(0, colon));
|
|
14559
|
+
}
|
|
14560
|
+
/** This function gives the events of the key `on` of a workflow: a block of keys, a block list, an inline list or one value. */
|
|
14561
|
+
function triggersOf(text) {
|
|
14562
|
+
const lines = workflowLines(text);
|
|
14563
|
+
const on = lines.findIndex((line) => indentOf$1(line) === 0 && keyValue(line, "on") !== void 0);
|
|
14564
|
+
if (on < 0) return [];
|
|
14565
|
+
const value = keyValue(lines[on] ?? "", "on") ?? "";
|
|
14566
|
+
if (value.startsWith("[")) return value.slice(1, -1).split(",").map(valueOf$1).filter(Boolean);
|
|
14567
|
+
if (value !== "") return [value];
|
|
14568
|
+
return childKeys(lines, on).map((index) => keyOf(lines[index] ?? ""));
|
|
14569
|
+
}
|
|
14570
|
+
/** This function gives the line of the job of the line `index`: the nearest line above it with a smaller indent, or -1. */
|
|
14571
|
+
function jobAt(lines, index) {
|
|
14572
|
+
let job = index - 1;
|
|
14573
|
+
while (job >= 0 && ((lines[job] ?? "").trim() === "" || indentOf$1(lines[job] ?? "") >= indentOf$1(lines[index] ?? ""))) job -= 1;
|
|
14574
|
+
return job;
|
|
14575
|
+
}
|
|
14576
|
+
/** This function gives the id of the job with the name `name`, or undefined. */
|
|
14577
|
+
function jobNamed(lines, name) {
|
|
14578
|
+
const jobs = lines.findIndex((line) => indentOf$1(line) === 0 && keyValue(line, "jobs") !== void 0);
|
|
14579
|
+
if (jobs < 0) return void 0;
|
|
14580
|
+
const job = childKeys(lines, jobs).find((index) => childKeys(lines, index).some((key) => keyValue(lines[key] ?? "", "name") === name));
|
|
14581
|
+
return job === void 0 ? void 0 : keyOf(lines[job] ?? "");
|
|
14582
|
+
}
|
|
14583
|
+
const siteCheckInCi = {
|
|
14584
|
+
id: "site-check-in-ci",
|
|
14585
|
+
title: "A repository that deploys a site with the Pages workflow has `.github/site.json`, gives no site value in the call, deploys on no pull request, and checks the site in a job that `CI OK` needs.",
|
|
14586
|
+
reason: "The deploy and the check of a pull request build the same site only when the values have one home. A job of a pull request with the permission `pages: write` is a risk, so the check is in its own workflow with read permissions. A check that `CI OK` does not need does not stop a merge: on 2026-11-08 the probe of a site ran only in the Pages workflow, and the required check did not wait for it.",
|
|
14587
|
+
fix: "Move the inputs of the call of `reusable-pages.yml` into `.github/site.json` (CI.md, \"The site config\"). Remove `pull_request` from the `on` of the Pages workflow, and call it from no workflow of a pull request. Add a job `site` to `ci.yml` that uses `reusable-pages-check.yml` with `permissions: contents: read`, and add `site` to the `needs` of `CI OK`.",
|
|
14588
|
+
sources: [{
|
|
14589
|
+
repo: "private",
|
|
14590
|
+
rule: "site-probe-in-ci",
|
|
14591
|
+
doc: "docs/STRATEGY.md (2026-11-08, the site check of each pull request in CI OK)"
|
|
14592
|
+
}],
|
|
14593
|
+
options: {
|
|
14594
|
+
workflows: {
|
|
14595
|
+
type: "strings",
|
|
14596
|
+
default: PAGES_WORKFLOWS,
|
|
14597
|
+
description: "The workflows that deploy a site, without the ref after `@`."
|
|
14598
|
+
},
|
|
14599
|
+
checks: {
|
|
14600
|
+
type: "strings",
|
|
14601
|
+
default: CHECK_WORKFLOWS,
|
|
14602
|
+
description: "The workflows that check a site on a pull request, without the ref after `@`."
|
|
14603
|
+
},
|
|
14604
|
+
gate: {
|
|
14605
|
+
type: "string",
|
|
14606
|
+
default: "CI OK",
|
|
14607
|
+
description: "The name of the job that the ruleset requires. It needs the job of the check."
|
|
14608
|
+
}
|
|
14609
|
+
},
|
|
14610
|
+
failsFrom: "2026-12-01",
|
|
14611
|
+
check(context, options) {
|
|
14612
|
+
const files = context.gitFiles();
|
|
14613
|
+
if (files === void 0) return { skipped: "the root is not in a git repository" };
|
|
14614
|
+
const gate = options["gate"];
|
|
14615
|
+
const workflows = files.filter((path) => WORKFLOW$1.test(path)).sort(byCode).map((file) => ({
|
|
14616
|
+
file,
|
|
14617
|
+
text: readFileSync(join(context.root, file), "utf8")
|
|
14618
|
+
}));
|
|
14619
|
+
const deploys = workflows.flatMap(({ file, text }) => pagesCalls(text, options["workflows"]).filter((call) => call.deploys).map((call) => ({
|
|
14620
|
+
file,
|
|
14621
|
+
text,
|
|
14622
|
+
line: call.line
|
|
14623
|
+
})));
|
|
14624
|
+
if (deploys.length === 0) return { skipped: "no workflow deploys a site with the Pages workflow" };
|
|
14625
|
+
const breaks = [];
|
|
14626
|
+
if (!files.includes(".github/site.json")) breaks.push({
|
|
14627
|
+
file: SITE_CONFIG_PATH,
|
|
14628
|
+
message: `The repository deploys a site, and it has no ${SITE_CONFIG_PATH}. The check of a pull request reads the site values there.`
|
|
14629
|
+
});
|
|
14630
|
+
const triggersRead = /* @__PURE__ */ new Set();
|
|
14631
|
+
for (const { file, text, line } of deploys) {
|
|
14632
|
+
const lines = workflowLines(text);
|
|
14633
|
+
const job = jobAt(lines, line - 1);
|
|
14634
|
+
const withAt = job < 0 ? void 0 : childKeys(lines, job).find((index) => keyValue(lines[index] ?? "", "with") !== void 0);
|
|
14635
|
+
for (const index of withAt === void 0 ? [] : childKeys(lines, withAt)) {
|
|
14636
|
+
const key = keyOf(lines[index] ?? "");
|
|
14637
|
+
if (Object.hasOwn(SITE_CONFIG_KEYS, key)) breaks.push({
|
|
14638
|
+
file,
|
|
14639
|
+
line: index + 1,
|
|
14640
|
+
message: `${file} gives the site value ${key} to the Pages workflow. Give it only in ${SITE_CONFIG_PATH}.`
|
|
14641
|
+
});
|
|
14642
|
+
}
|
|
14643
|
+
if (triggersRead.has(file)) continue;
|
|
14644
|
+
triggersRead.add(file);
|
|
14645
|
+
const events = triggersOf(text).filter((event) => PULL_REQUEST.has(event));
|
|
14646
|
+
if (events.length > 0) breaks.push({
|
|
14647
|
+
file,
|
|
14648
|
+
message: `${file} deploys the site and starts on ${events.join(" and ")}, so a job of a pull request gets the permission pages: write.`
|
|
14649
|
+
});
|
|
14650
|
+
for (const caller of workflows) {
|
|
14651
|
+
const callerEvents = triggersOf(caller.text).filter((event) => PULL_REQUEST.has(event));
|
|
14652
|
+
if (callerEvents.length === 0) continue;
|
|
14653
|
+
workflowLines(caller.text).forEach((text, index) => {
|
|
14654
|
+
if ((keyValue(text, "uses") ?? "").split("@")[0] !== `./${file}`) return;
|
|
14655
|
+
breaks.push({
|
|
14656
|
+
file: caller.file,
|
|
14657
|
+
line: index + 1,
|
|
14658
|
+
message: `${caller.file} starts on ${callerEvents.join(" and ")} and calls ${file}, which deploys the site. A job of a pull request gets the permission pages: write.`
|
|
14659
|
+
});
|
|
14660
|
+
});
|
|
14661
|
+
}
|
|
14662
|
+
}
|
|
14663
|
+
const checks = workflows.flatMap(({ file, text }) => pagesCalls(text, options["checks"]).map((call) => ({
|
|
14664
|
+
file,
|
|
14665
|
+
text,
|
|
14666
|
+
line: call.line
|
|
14667
|
+
})));
|
|
14668
|
+
if (checks.length === 0) breaks.push({
|
|
14669
|
+
file: ".github/workflows/ci.yml",
|
|
14670
|
+
message: `No job checks the site on a pull request. Add a job that uses reusable-pages-check.yml, and add it to the needs of ${gate}.`
|
|
14671
|
+
});
|
|
14672
|
+
for (const { file, text, line } of checks) {
|
|
14673
|
+
const lines = workflowLines(text);
|
|
14674
|
+
const id = keyOf(lines[jobAt(lines, line - 1)] ?? "");
|
|
14675
|
+
const gateId = jobNamed(lines, gate);
|
|
14676
|
+
if ((gateId === void 0 ? void 0 : readWorkflow(file, text).jobs.find((job) => job.id === gateId)?.needs)?.includes(id)) continue;
|
|
14677
|
+
breaks.push({
|
|
14678
|
+
file,
|
|
14679
|
+
line,
|
|
14680
|
+
message: gateId === void 0 ? `${file} checks the site in the job ${id}, and the file has no job ${gate}, so a failed check does not stop a merge.` : `The job ${gate} of ${file} does not need the job ${id}, so a failed check of the site does not stop a merge.`
|
|
14681
|
+
});
|
|
14682
|
+
}
|
|
14683
|
+
return breaks;
|
|
14684
|
+
}
|
|
14685
|
+
};
|
|
14332
14686
|
// src/rules/pinned-git-deps.ts
|
|
14333
14687
|
/**
|
|
14334
14688
|
* The rule `pinned-git-deps`: a dependency from git names a full commit.
|
|
@@ -15256,7 +15610,8 @@ const requiredScripts = {
|
|
|
15256
15610
|
};
|
|
15257
15611
|
// src/rules/roadmap-parses.ts
|
|
15258
15612
|
/**
|
|
15259
|
-
* The rule `roadmap-parses`: each roadmap that a workflow gives to the Status page parses, on the
|
|
15613
|
+
* The rule `roadmap-parses`: each roadmap that a workflow or the site config gives to the Status page parses, on the
|
|
15614
|
+
* pull request.
|
|
15260
15615
|
*/
|
|
15261
15616
|
/** A workflow file. */
|
|
15262
15617
|
const WORKFLOW = /^\.github\/workflows\/[^/]+\.ya?ml$/;
|
|
@@ -15285,6 +15640,7 @@ function noStatusPage(line) {
|
|
|
15285
15640
|
/**
|
|
15286
15641
|
* This function gives the line numbers of each call of the Pages workflow that gives no `roadmap` key. The key is in the
|
|
15287
15642
|
* job of the call: the lines around it with the same indent or more. A job with `site-pages: false` has no Status page.
|
|
15643
|
+
* A repository with a site config gives its site values there, so the rule reads the file in place of the call.
|
|
15288
15644
|
*/
|
|
15289
15645
|
function callsWithoutRoadmap(lines) {
|
|
15290
15646
|
const found = [];
|
|
@@ -15300,6 +15656,27 @@ function callsWithoutRoadmap(lines) {
|
|
|
15300
15656
|
});
|
|
15301
15657
|
return found;
|
|
15302
15658
|
}
|
|
15659
|
+
/** This function reads the site config of the repository, and gives its roadmap. An empty roadmap with `site-pages: false` is no roadmap. */
|
|
15660
|
+
function configRoadmap(root, files) {
|
|
15661
|
+
if (!files.includes(".github/site.json")) return void 0;
|
|
15662
|
+
const text = readFileSync(join(root, SITE_CONFIG_PATH), "utf8");
|
|
15663
|
+
const result = resolveSiteConfig({
|
|
15664
|
+
file: text,
|
|
15665
|
+
path: SITE_CONFIG_PATH,
|
|
15666
|
+
inputs: void 0,
|
|
15667
|
+
repository: ""
|
|
15668
|
+
});
|
|
15669
|
+
if ("error" in result) return { error: result.error };
|
|
15670
|
+
const line = text.split(/\r?\n/).findIndex((each) => each.includes("\"roadmap\"")) + 1;
|
|
15671
|
+
if (result.config.roadmap === "") return {
|
|
15672
|
+
roadmap: result.config["site-pages"] ? "" : void 0,
|
|
15673
|
+
line
|
|
15674
|
+
};
|
|
15675
|
+
return {
|
|
15676
|
+
roadmap: cleanPath(result.config.roadmap),
|
|
15677
|
+
line
|
|
15678
|
+
};
|
|
15679
|
+
}
|
|
15303
15680
|
/** This function gives the value of a `roadmap: <file>` line, or undefined for another line, an empty value or an expression. */
|
|
15304
15681
|
function roadmapOfLine(line) {
|
|
15305
15682
|
const text = line.trimStart();
|
|
@@ -15315,9 +15692,9 @@ function roadmapOfLine(line) {
|
|
|
15315
15692
|
}
|
|
15316
15693
|
const roadmapParses = {
|
|
15317
15694
|
id: "roadmap-parses",
|
|
15318
|
-
title: "Each call of the Pages workflow gives a roadmap, and each roadmap that a workflow gives to the Status page
|
|
15695
|
+
title: "Each call of the Pages workflow gives a roadmap, in the call or in `.github/site.json`, and each roadmap that a workflow or the site config gives to the Status page parses as site-pages reads it.",
|
|
15319
15696
|
reason: "Only the Pages job on main reads the roadmap. A pull request with a bad table row passes each check, and then the build of the site stops and the site stays stale. On 2026-10-30, one repository had 3 red Pages runs in a row because of one row with 2 cells under a header with 4. A site with no roadmap is the same fault with no error: its Status page shows no item of the plan, and each check is green. On 2026-10-30, 2 repositories had a site with no roadmap.",
|
|
15320
|
-
fix: "Give the roadmap file
|
|
15697
|
+
fix: "Give the roadmap file in `.github/site.json` (`\"roadmap\": \"docs/ROADMAP.md\"`), or to the Pages workflow when the repository has no site config. Correct the row or the heading that the message names. Each table row has one cell for each column of its header, and the file has a table with an ID column and a Status column, or a heading \"### `id`: Title\".",
|
|
15321
15698
|
sources: [{
|
|
15322
15699
|
repo: "private",
|
|
15323
15700
|
rule: "fail-closed",
|
|
@@ -15333,6 +15710,8 @@ const roadmapParses = {
|
|
|
15333
15710
|
if (files === void 0) return { skipped: "the root is not in a git repository" };
|
|
15334
15711
|
const named = [];
|
|
15335
15712
|
const breaks = [];
|
|
15713
|
+
const config = configRoadmap(context.root, files);
|
|
15714
|
+
let calls = 0;
|
|
15336
15715
|
for (const file of files.filter((path) => WORKFLOW.test(path)).sort(byCode)) {
|
|
15337
15716
|
const lines = readFileSync(join(context.root, file), "utf8").split(/\r?\n/);
|
|
15338
15717
|
lines.forEach((line, index) => {
|
|
@@ -15343,12 +15722,29 @@ const roadmapParses = {
|
|
|
15343
15722
|
line: index + 1
|
|
15344
15723
|
});
|
|
15345
15724
|
});
|
|
15346
|
-
for (const line of callsWithoutRoadmap(lines))
|
|
15347
|
-
|
|
15348
|
-
|
|
15349
|
-
|
|
15350
|
-
|
|
15725
|
+
for (const line of callsWithoutRoadmap(lines)) {
|
|
15726
|
+
calls += 1;
|
|
15727
|
+
if (config !== void 0) continue;
|
|
15728
|
+
breaks.push({
|
|
15729
|
+
file,
|
|
15730
|
+
line,
|
|
15731
|
+
message: `${file} builds the site with the Pages workflow and gives no roadmap, so the Status page shows no roadmap item.`
|
|
15732
|
+
});
|
|
15733
|
+
}
|
|
15351
15734
|
}
|
|
15735
|
+
if (config !== void 0 && "error" in config) breaks.push({
|
|
15736
|
+
file: SITE_CONFIG_PATH,
|
|
15737
|
+
message: config.error
|
|
15738
|
+
});
|
|
15739
|
+
else if (config !== void 0 && calls > 0 && config.roadmap === "") breaks.push({
|
|
15740
|
+
file: SITE_CONFIG_PATH,
|
|
15741
|
+
message: `${SITE_CONFIG_PATH} gives no roadmap, so the Status page shows no roadmap item.`
|
|
15742
|
+
});
|
|
15743
|
+
else if (config?.roadmap !== void 0 && config.roadmap !== "") named.push({
|
|
15744
|
+
roadmap: config.roadmap,
|
|
15745
|
+
file: SITE_CONFIG_PATH,
|
|
15746
|
+
line: config.line
|
|
15747
|
+
});
|
|
15352
15748
|
for (const roadmap of options["roadmaps"]) named.push({
|
|
15353
15749
|
roadmap: cleanPath(roadmap),
|
|
15354
15750
|
file: "the option roadmaps",
|
|
@@ -16816,6 +17212,7 @@ const RULES = [
|
|
|
16816
17212
|
packNoBuildinfo,
|
|
16817
17213
|
exportsRequire,
|
|
16818
17214
|
pagesSite,
|
|
17215
|
+
siteCheckInCi,
|
|
16819
17216
|
pagesAfterRelease,
|
|
16820
17217
|
sharedDocs
|
|
16821
17218
|
];
|
|
@@ -17714,6 +18111,6 @@ function runHook(args, io) {
|
|
|
17714
18111
|
git: (gitArgs) => runGit(io.cwd, gitArgs)
|
|
17715
18112
|
}, io);
|
|
17716
18113
|
}
|
|
17717
|
-
export { unreleasedChangeRule as $,
|
|
18114
|
+
export { unreleasedChangeRule as $, specifiersOf as $n, messageOf as $t, typedFiles as A, ACTIONS_COMMIT as An, lineNameHit as At, roadmapParses as B, DEPENDENCY_FIELDS as Bn, apiReportScript as Bt, versionTitle as C, setupCue as Cn, privatePatterns as Ct, typedScripts as D, securityCallers as Dn, firstNameMatch as Dt, trustPolicy as E, SECURITY_TIMEOUT_MINUTES as En, PrivateNameListError as Et, HOME_TIMEOUT_MS as F, gateAfterCancel as Fn, noBuildOutput as Ft, publishedMinor as G, inFolder as Gn, mitText as Gt, releaseFiles as H, cleanPath as Hn, authorOf as Ht, blockHash as I, readAction as In, REAL_COMPARE as It, NPM_REGISTRY as J, matchesAny as Jn, moduleMessage as Jt, publishedMinorRule as K, keyLine as Kn, repositoryIsPublic as Kt, githubFetch as L, readWorkflow as Ln, hasImportMetaMain as Lt, isSourcePath as M, gateTrigger as Mn, nameMatches as Mt, pathsOf as N, prPathFilters as Nn, parsePrivateNames as Nt, configsOfScript as O, securityOneJob as On, isAllowedHit as Ot, sourceMain as P, summaryName as Pn, pathNameHit as Pt, unreleasedChange as Q, runGit as Qn, homePackage as Qt, sharedDocsRule as R, STRICT_OPTIONS as Rn, mainCheck as Rt, setVersions as S, sharedCi as Sn, privateNamesFile as St, TRAIN_SCOPES as T, SECURITY_SCAN_INPUTS as Tn, PRIVATE_NAME_LIST as Tt, lockedVersions as U, codePackages as Un, licenseFile as Ut, requiredScripts as V, RULE_WARN_DAYS as Vn, LICENSE_TEXTS as Vt, minorOf as W, hasFile as Wn, licenseFileOf as Wt, UNSHIPPED_FILES as X, readJsonc as Xn, modulesOf as Xt, SHIPPED_FIELDS as Y, parseJsonc as Yn, moduleUses as Yt, npmLookup as Z, replaceLine as Zn, declaredName as Zt, workspaceProtocol as _, tsconfigTest as _n, PRIVATE_NAMES_FILE_CONFIG as _t, listRules as a, MAP_RULE as an, pagesAfterRelease as at, yamlFaults as b, SHARED_WORKFLOWS as bn, invalidPatternBreaks as bt, runCli as c, mapText as cn, scheduleMinute as ct, HOOK_MARKER as d, npmNames as dn, pagesCalls as dt, repoOf as en, defaultOptions as er, pipeFails as et, NO_READ_LINE as f, readOverlay as fn, pagesSite as ft, RULES as g, hasTests as gn, HOME_PATTERNS as gt, prePush as h, serviceRunMain as hn, DEFAULT_ALLOWED as ht, formatResult as i, HOMES as in, siteCheckInCi as it, testsRequired as j, convertGate as jn, lineNameHits as jt, scriptsOf as k, withOneJob as kn, isCommonUse as kt, runFix as l, mergeHomes as ln, pushMainOnly as lt, installHook as m, runCalls as mn, packNoBuildinfo as mt, annotations as n, signaturesOf as nn, isPinned as nt, readConfig as o, findHomes as on, repositoryOfRemote as ot, PRE_PUSH_HOOK as p, SERVICE_PACKAGE as pn, exportsRequire as pt, reachOf as q, lineOf as qn, homeModule as qt, createContext as r, HOME_EXPORTS as rn, pinnedGitDeps as rt, runChecks as s, mapMarkdown as sn, runnerBudget as st, USAGE as t, reposOf as tn, parseConfig as tr, isGitSpecifier as tt, summaryMarkdown as u, npmDrift as un, PAGES_WORKFLOWS as ut, GITHUB_YAML as v, SHARED_ACTIONS as vn, PRIVATE_NAMES_FILE_VARIABLE as vt, IGNORE_AFTER as w, SECURITY_SCAN_COMMIT as wn, privateTextBreaks as wt, namedVersions as x, callsSharedCi as xn, noLocalPaths as xt, workflowParses as y, SHARED_CI as yn, PRIVATE_PATTERNS_VARIABLE as yt, roadmapOfLine as z, cuePreset as zn, coverageProvider as zt };
|
|
17718
18115
|
|
|
17719
|
-
//# sourceMappingURL=run-
|
|
18116
|
+
//# sourceMappingURL=run-B9bgU10k.js.map
|