@mark1russell7/conventions 0.64.3 → 0.64.4
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 +2 -1
- package/build/cli.js +1 -1
- package/build/index.d.ts +8 -0
- package/build/index.d.ts.map +1 -1
- package/build/index.js +2 -2
- package/build/{run-gqm9mBei.js → run-CeEPIgVg.js} +238 -40
- package/build/run-CeEPIgVg.js.map +1 -0
- package/package.json +2 -2
- package/build/run-gqm9mBei.js.map +0 -1
|
@@ -5,7 +5,7 @@ import { createRequire } from "node:module";
|
|
|
5
5
|
import { spawnSync } from "node:child_process";
|
|
6
6
|
import { appendFileSync, chmodSync, existsSync, mkdirSync, readFileSync, readdirSync, statSync, writeFileSync } from "node:fs";
|
|
7
7
|
import { basename, delimiter, dirname, extname, isAbsolute, join, posix, relative, resolve } from "node:path";
|
|
8
|
-
import { LineCounter, isMap, isScalar, parseAllDocuments } from "yaml";
|
|
8
|
+
import { LineCounter, isMap, isScalar, isSeq, parseAllDocuments } from "yaml";
|
|
9
9
|
import { errorMessage } from "@mark1russell7/text";
|
|
10
10
|
import { createHash } from "node:crypto";
|
|
11
11
|
import { containsShape, functionsOf } from "@mark1russell7/code-shape";
|
|
@@ -1821,7 +1821,7 @@ function inputsOf(owner) {
|
|
|
1821
1821
|
return Object.fromEntries(Object.entries(inputs).map(([key, value]) => [key, optionalText(value)]));
|
|
1822
1822
|
}
|
|
1823
1823
|
/** This function reads a step: the same label as the line reader gives, its condition, its action and its secrets. */
|
|
1824
|
-
function parsedStep(value) {
|
|
1824
|
+
function parsedStep(value, line) {
|
|
1825
1825
|
const step = isObject$1(value) ? value : {};
|
|
1826
1826
|
const uses = actionOf(optionalText(step["uses"]));
|
|
1827
1827
|
return {
|
|
@@ -1830,7 +1830,8 @@ function parsedStep(value) {
|
|
|
1830
1830
|
uses,
|
|
1831
1831
|
secrets: [...secretsOf(step)],
|
|
1832
1832
|
with: inputsOf(step),
|
|
1833
|
-
run: optionalText(step["run"])
|
|
1833
|
+
run: optionalText(step["run"]),
|
|
1834
|
+
line
|
|
1834
1835
|
};
|
|
1835
1836
|
}
|
|
1836
1837
|
/** This function gives the `concurrency` of a workflow or of a job: a group as one text, or a map with `group`. */
|
|
@@ -1893,8 +1894,14 @@ function matrixJobsOf(strategy) {
|
|
|
1893
1894
|
const added = included.filter((entry) => !combinations.some((combination) => agrees(entry, combination, keys))).length;
|
|
1894
1895
|
return combinations.length + added;
|
|
1895
1896
|
}
|
|
1896
|
-
/** This function
|
|
1897
|
-
function
|
|
1897
|
+
/** This function gives the folder of `defaults.run.working-directory` of a workflow or of a job, or an empty text. */
|
|
1898
|
+
function defaultDirectoryOf(owner) {
|
|
1899
|
+
const defaults = owner["defaults"];
|
|
1900
|
+
const run = isObject$1(defaults) ? defaults["run"] : void 0;
|
|
1901
|
+
return isObject$1(run) ? optionalText(run["working-directory"]) : "";
|
|
1902
|
+
}
|
|
1903
|
+
/** This function reads a job. The folder `workflowDirectory` is the default folder of the workflow. */
|
|
1904
|
+
function parsedJob(id, value, at, workflowDirectory) {
|
|
1898
1905
|
const job = isObject$1(value) ? value : {};
|
|
1899
1906
|
const secrets = secretsOf(job);
|
|
1900
1907
|
if (job["secrets"] === "inherit") secrets.add("inherit");
|
|
@@ -1902,8 +1909,8 @@ function parsedJob(id, value, line, lines) {
|
|
|
1902
1909
|
const limit = strategy["max-parallel"];
|
|
1903
1910
|
return {
|
|
1904
1911
|
id,
|
|
1905
|
-
line,
|
|
1906
|
-
lines,
|
|
1912
|
+
line: at.line,
|
|
1913
|
+
lines: at.lines,
|
|
1907
1914
|
name: optionalText(job["name"]) || id,
|
|
1908
1915
|
maxParallel: typeof limit === "number" && Number.isInteger(limit) && limit > 0 ? limit : null,
|
|
1909
1916
|
matrixJobs: isExpression(job["strategy"]) || isExpression(strategy["matrix"]) ? null : matrixJobsOf(strategy),
|
|
@@ -1914,7 +1921,8 @@ function parsedJob(id, value, line, lines) {
|
|
|
1914
1921
|
with: inputsOf(job),
|
|
1915
1922
|
permissions: permissionsOf(job),
|
|
1916
1923
|
secrets: [...secrets],
|
|
1917
|
-
steps: Array.isArray(job["steps"]) ? job["steps"].map(parsedStep) : []
|
|
1924
|
+
steps: Array.isArray(job["steps"]) ? job["steps"].map((step, index) => parsedStep(step, at.steps[index] ?? at.line)) : [],
|
|
1925
|
+
defaultDirectory: defaultDirectoryOf(job) || workflowDirectory
|
|
1918
1926
|
};
|
|
1919
1927
|
}
|
|
1920
1928
|
/** This function gives the line of each key of a map node of the parser, two keys deep. A key that is not a scalar has no line. */
|
|
@@ -1974,12 +1982,20 @@ function parseWorkflow(file, text) {
|
|
|
1974
1982
|
const jobsNode = first.get("jobs");
|
|
1975
1983
|
if (isMap(jobsNode)) for (const pair of jobsNode.items) {
|
|
1976
1984
|
const at = isScalar(pair.key) ? pair.key.range?.[0] : void 0;
|
|
1977
|
-
if (at
|
|
1985
|
+
if (at === void 0) continue;
|
|
1986
|
+
const stepsNode = isMap(pair.value) ? pair.value.get("steps", true) : void 0;
|
|
1987
|
+
const steps = isSeq(stepsNode) ? stepsNode.items.map((item) => item !== null && typeof item === "object" && "range" in item && Array.isArray(item.range) ? lineOf(item.range[0]) : lineOf(at)) : [];
|
|
1988
|
+
jobNodes.set(String(pair.key.value), {
|
|
1978
1989
|
line: lineOf(at),
|
|
1979
|
-
lines: keyLinesOf(pair.value, lineOf)
|
|
1990
|
+
lines: keyLinesOf(pair.value, lineOf),
|
|
1991
|
+
steps
|
|
1980
1992
|
});
|
|
1981
1993
|
}
|
|
1982
|
-
const jobs = isObject$1(top["jobs"]) ? Object.entries(top["jobs"]).map(([id, job]) => parsedJob(id, job, jobNodes.get(id)
|
|
1994
|
+
const jobs = isObject$1(top["jobs"]) ? Object.entries(top["jobs"]).map(([id, job]) => parsedJob(id, job, jobNodes.get(id) ?? {
|
|
1995
|
+
line: 1,
|
|
1996
|
+
lines: {},
|
|
1997
|
+
steps: []
|
|
1998
|
+
}, defaultDirectoryOf(top))) : [];
|
|
1983
1999
|
const secrets = secretsOf(top);
|
|
1984
2000
|
if (jobs.some((job) => job.secrets.includes("inherit"))) secrets.add("inherit");
|
|
1985
2001
|
const lines = keyLinesOf(first.contents, lineOf);
|
|
@@ -4127,9 +4143,9 @@ const callPermissions = callPermissionsRule();
|
|
|
4127
4143
|
* GitHub fails at times with a 504, and a bare `curl` then fails the job.
|
|
4128
4144
|
*/
|
|
4129
4145
|
/** The files of a composite action. */
|
|
4130
|
-
const ACTION$
|
|
4146
|
+
const ACTION$7 = /^\.github\/actions\/.+\/action\.ya?ml$/;
|
|
4131
4147
|
/** The action of the template itself. It is the one place with the download. */
|
|
4132
|
-
const SHARED_ACTION$
|
|
4148
|
+
const SHARED_ACTION$3 = ".github/actions/setup-cue/action.yml";
|
|
4133
4149
|
/** A hand-written install of the cue CLI: a download of a release asset, or a build with `go install`. */
|
|
4134
4150
|
const DOWNLOAD = /github\.com\/cue-lang\/cue\/releases\/download\/(v[0-9][^/\s"']*)\/|cuelang\.org\/go\/cmd\/cue@(v?[0-9][^\s"']*|latest)/;
|
|
4135
4151
|
/** This function gives each line of a file that installs the cue CLI with its own command. It does not read a comment line. */
|
|
@@ -4174,7 +4190,7 @@ const setupCue = {
|
|
|
4174
4190
|
const files = context.gitFiles();
|
|
4175
4191
|
if (files === void 0) return { skipped: "the root is not in a git repository" };
|
|
4176
4192
|
const breaks = [];
|
|
4177
|
-
for (const file of files.filter((path) => (WORKFLOW$1.test(path) || ACTION$
|
|
4193
|
+
for (const file of files.filter((path) => (WORKFLOW$1.test(path) || ACTION$7.test(path)) && path !== SHARED_ACTION$3).sort(byCode)) {
|
|
4178
4194
|
let text;
|
|
4179
4195
|
try {
|
|
4180
4196
|
text = readFileSync(join(context.root, file), "utf8");
|
|
@@ -4200,9 +4216,9 @@ const setupCue = {
|
|
|
4200
4216
|
* `pnpm/action-setup` step fails the job when its fetch of pnpm stalls or when the pnpm that it installed does not start.
|
|
4201
4217
|
*/
|
|
4202
4218
|
/** The files of a composite action. */
|
|
4203
|
-
const ACTION$
|
|
4219
|
+
const ACTION$6 = /^\.github\/actions\/.+\/action\.ya?ml$/;
|
|
4204
4220
|
/** The action of the template itself. It is the one place with the step `pnpm/action-setup`. */
|
|
4205
|
-
const SHARED_ACTION$
|
|
4221
|
+
const SHARED_ACTION$2 = ".github/actions/setup-pnpm/action.yml";
|
|
4206
4222
|
/** A step that uses the action `pnpm/action-setup`, with its ref and the version in the comment after it. */
|
|
4207
4223
|
const ACTION_SETUP = /^\s*(?:-\s+)?uses:\s*["']?pnpm\/action-setup@([^\s"'#]+)["']?\s*(?:#\s*(\S+))?/;
|
|
4208
4224
|
/** The npm command of a global install, up to a comment or the end of the command. */
|
|
@@ -4244,7 +4260,7 @@ const setupPnpm = {
|
|
|
4244
4260
|
id: "setup-pnpm",
|
|
4245
4261
|
title: "pnpm comes from the shared action `setup-pnpm`, not from a step `pnpm/action-setup` or a global npm install in a workflow.",
|
|
4246
4262
|
reason: "A fetch of pnpm stalls at times, and the pnpm that an install gives does not always start. On 2026-12-02 a stalled fetch (EIDLETIMEOUT) failed the memory probe of layout-contract, and a pnpm that did not start failed the CI of wirelab. On 2026-12-03 one failed install made the weekly site run of packing red, and its 323 other jobs passed.",
|
|
4247
|
-
fix: "Use the step `uses: mark1russell7/template/.github/actions/setup-pnpm@<commit>` in place of `pnpm/action-setup`. The action reads the version from the field `packageManager` of `package.json`: move a `with: version` to that field. The input `package_json_file` becomes `package-json-file`. In place of `run_install`, add the step `
|
|
4263
|
+
fix: "Use the step `uses: mark1russell7/template/.github/actions/setup-pnpm@<commit>` in place of `pnpm/action-setup`. The action reads the version from the field `packageManager` of `package.json`: move a `with: version` to that field. The input `package_json_file` becomes `package-json-file`. In place of `run_install`, add the step `uses: mark1russell7/template/.github/actions/pnpm-install@<commit>`.",
|
|
4248
4264
|
sources: [
|
|
4249
4265
|
{
|
|
4250
4266
|
repo: "layout-contract",
|
|
@@ -4273,7 +4289,7 @@ const setupPnpm = {
|
|
|
4273
4289
|
const files = context.gitFiles();
|
|
4274
4290
|
if (files === void 0) return { skipped: "the root is not in a git repository" };
|
|
4275
4291
|
const breaks = [];
|
|
4276
|
-
for (const file of files.filter((path) => (WORKFLOW$1.test(path) || ACTION$
|
|
4292
|
+
for (const file of files.filter((path) => (WORKFLOW$1.test(path) || ACTION$6.test(path)) && path !== SHARED_ACTION$2).sort(byCode)) {
|
|
4277
4293
|
let text;
|
|
4278
4294
|
try {
|
|
4279
4295
|
text = readFileSync(join(context.root, file), "utf8");
|
|
@@ -4362,14 +4378,16 @@ const VALUE_OPTIONS = /* @__PURE__ */ new Set([
|
|
|
4362
4378
|
const INSTALL_COMMANDS = /* @__PURE__ */ new Set(["install", "i"]);
|
|
4363
4379
|
/** The option `--filter=` before the selector in one word. */
|
|
4364
4380
|
const FILTER_EQUALS = "--filter=";
|
|
4365
|
-
/** This function gives the
|
|
4366
|
-
function
|
|
4381
|
+
/** This function gives the install of the command `words`, or undefined when the command is not a `pnpm install`. */
|
|
4382
|
+
function installOf(words, editable, action) {
|
|
4367
4383
|
let at = 0;
|
|
4368
4384
|
while (at < words.length && !PNPM.test(words[at]?.text ?? "")) {
|
|
4369
4385
|
const text = words[at]?.text ?? "";
|
|
4370
|
-
if (!LAUNCHERS.has(text) && !(at > 0 && LAUNCHER_ARGUMENT.test(text)) && !/^[A-Za-z_]\w*=/.test(text)) return
|
|
4386
|
+
if (!LAUNCHERS.has(text) && !(at > 0 && LAUNCHER_ARGUMENT.test(text)) && !/^[A-Za-z_]\w*=/.test(text)) return void 0;
|
|
4371
4387
|
at += 1;
|
|
4372
4388
|
}
|
|
4389
|
+
const pnpm = words[at];
|
|
4390
|
+
if (pnpm === void 0) return void 0;
|
|
4373
4391
|
const args = words.slice(at + 1);
|
|
4374
4392
|
let command;
|
|
4375
4393
|
const found = [];
|
|
@@ -4397,9 +4415,15 @@ function selectorsOf(words, editable) {
|
|
|
4397
4415
|
if (command === void 0 && VALUE_OPTIONS.has(word.text)) index += 1;
|
|
4398
4416
|
} else command ??= word.text;
|
|
4399
4417
|
}
|
|
4400
|
-
|
|
4418
|
+
if (command === void 0 || !INSTALL_COMMANDS.has(command)) return void 0;
|
|
4419
|
+
return {
|
|
4420
|
+
line: pnpm.line + 1,
|
|
4421
|
+
words: words.slice(at).map((word) => word.text),
|
|
4422
|
+
action,
|
|
4423
|
+
selectors: found
|
|
4424
|
+
};
|
|
4401
4425
|
}
|
|
4402
|
-
/** This function gives
|
|
4426
|
+
/** This function gives each `pnpm install` in the tokens of one command line. */
|
|
4403
4427
|
function installsOf(tokens, editable) {
|
|
4404
4428
|
const found = [];
|
|
4405
4429
|
let words = [];
|
|
@@ -4408,11 +4432,80 @@ function installsOf(tokens, editable) {
|
|
|
4408
4432
|
words.push(token);
|
|
4409
4433
|
continue;
|
|
4410
4434
|
}
|
|
4411
|
-
|
|
4435
|
+
const install = installOf(words, editable, false);
|
|
4436
|
+
if (install !== void 0) found.push(install);
|
|
4412
4437
|
words = [];
|
|
4413
4438
|
}
|
|
4414
4439
|
return found;
|
|
4415
4440
|
}
|
|
4441
|
+
/** The value of `uses` of a step with the action `pnpm-install` of the template, pinned or in a local folder. */
|
|
4442
|
+
const PNPM_INSTALL_ACTION = /(?:^|\/)\.github\/actions\/pnpm-install(?:@|\/?\s*$|\/?\s+#)/;
|
|
4443
|
+
/** The place of the key of a line: its indent, also after the `- ` of a list item. */
|
|
4444
|
+
const keyPlace = (line) => line.length - line.trimStart().replace(/^-\s+/, "").length;
|
|
4445
|
+
/**
|
|
4446
|
+
* This function gives true when the key under `with` at the line `index` is an input of the action `pnpm-install`.
|
|
4447
|
+
* It reads the keys of the step before and after `with`.
|
|
4448
|
+
*/
|
|
4449
|
+
function inPnpmInstallStep(lines, index) {
|
|
4450
|
+
const own = indentOf$1(lines[index] ?? "");
|
|
4451
|
+
let at = index - 1;
|
|
4452
|
+
while (at >= 0 && ((lines[at] ?? "").trim() === "" || indentOf$1(lines[at] ?? "") >= own)) at -= 1;
|
|
4453
|
+
const withLine = lines[at] ?? "";
|
|
4454
|
+
if (at < 0 || KEY$1.exec(withLine)?.[1] !== "with") return false;
|
|
4455
|
+
const step = keyPlace(withLine);
|
|
4456
|
+
const usesAction = (line) => {
|
|
4457
|
+
const key = KEY$1.exec(line);
|
|
4458
|
+
return key?.[1] === "uses" && PNPM_INSTALL_ACTION.test(line.slice(key[0].length).replace(/^["']|["']\s*$/g, ""));
|
|
4459
|
+
};
|
|
4460
|
+
for (let back = at; back >= 0; back -= 1) {
|
|
4461
|
+
const line = lines[back] ?? "";
|
|
4462
|
+
if (line.trim() === "" || indentOf$1(line) > step) continue;
|
|
4463
|
+
if (keyPlace(line) !== step) break;
|
|
4464
|
+
if (usesAction(line)) return true;
|
|
4465
|
+
if (/^\s*-\s/.test(line)) break;
|
|
4466
|
+
}
|
|
4467
|
+
for (let next = at + 1; next < lines.length; next += 1) {
|
|
4468
|
+
const line = lines[next] ?? "";
|
|
4469
|
+
if (line.trim() === "" || indentOf$1(line) > step) continue;
|
|
4470
|
+
if (indentOf$1(line) !== step || /^\s*-\s/.test(line)) break;
|
|
4471
|
+
if (usesAction(line)) return true;
|
|
4472
|
+
}
|
|
4473
|
+
return false;
|
|
4474
|
+
}
|
|
4475
|
+
/**
|
|
4476
|
+
* This function gives the install of the input `args` at the line `index`, or undefined for another key or step. The
|
|
4477
|
+
* action `pnpm-install` starts `pnpm install` with the words of the input.
|
|
4478
|
+
*/
|
|
4479
|
+
function actionInstall(lines, index, key) {
|
|
4480
|
+
if (key[1] !== "args" || !inPnpmInstallStep(lines, index)) return void 0;
|
|
4481
|
+
const line = lines[index] ?? "";
|
|
4482
|
+
let from = key[0].length;
|
|
4483
|
+
let to = line.length;
|
|
4484
|
+
const value = line.slice(from).trimEnd();
|
|
4485
|
+
const quote = value.charAt(0);
|
|
4486
|
+
const quoted = (quote === "\"" || quote === "'") && value.length > 1 && value.endsWith(quote);
|
|
4487
|
+
if (quoted) {
|
|
4488
|
+
from += 1;
|
|
4489
|
+
to = from + value.length - 2;
|
|
4490
|
+
}
|
|
4491
|
+
const at = {
|
|
4492
|
+
line: index,
|
|
4493
|
+
start: key[0].length,
|
|
4494
|
+
end: key[0].length,
|
|
4495
|
+
operator: false
|
|
4496
|
+
};
|
|
4497
|
+
return installOf([
|
|
4498
|
+
{
|
|
4499
|
+
...at,
|
|
4500
|
+
text: "pnpm"
|
|
4501
|
+
},
|
|
4502
|
+
{
|
|
4503
|
+
...at,
|
|
4504
|
+
text: "install"
|
|
4505
|
+
},
|
|
4506
|
+
...shellTokens(line.slice(0, to), index, from).tokens.filter((token) => !token.operator)
|
|
4507
|
+
], !quoted, true);
|
|
4508
|
+
}
|
|
4416
4509
|
/** This function gives the end of the block of text under the key at the line `index`. The indent of a key after `- ` is the place of the key. */
|
|
4417
4510
|
function textEnd(lines, index) {
|
|
4418
4511
|
const line = lines[index] ?? "";
|
|
@@ -4422,12 +4515,12 @@ function textEnd(lines, index) {
|
|
|
4422
4515
|
return end;
|
|
4423
4516
|
}
|
|
4424
4517
|
/**
|
|
4425
|
-
* This function gives
|
|
4426
|
-
* `pnpm --filter <selector> install
|
|
4427
|
-
* after `&&`, `;`, `|` and in `( )`. It reads a command
|
|
4428
|
-
* value of a key for a person or for GitHub (`name`, `if`).
|
|
4518
|
+
* This function gives each `pnpm install` of a workflow or a composite action, also `pnpm i` and
|
|
4519
|
+
* `pnpm --filter <selector> install`. It also gives the input `args` of each step with the action `pnpm-install`. It
|
|
4520
|
+
* reads the value of each key, the lines of a block of text, and the commands after `&&`, `;`, `|` and in `( )`. It reads a command
|
|
4521
|
+
* that continues after a `\`. It does not read comments, or the value of a key for a person or for GitHub (`name`, `if`).
|
|
4429
4522
|
*/
|
|
4430
|
-
function
|
|
4523
|
+
function pnpmInstallCommands(text) {
|
|
4431
4524
|
const lines = workflowLines(text);
|
|
4432
4525
|
const found = [];
|
|
4433
4526
|
let pending = [];
|
|
@@ -4444,6 +4537,11 @@ function filteredInstalls(text) {
|
|
|
4444
4537
|
if (/^[|>]/.test(value)) index = textEnd(lines, index) - 1;
|
|
4445
4538
|
continue;
|
|
4446
4539
|
}
|
|
4540
|
+
const action = key === null ? void 0 : actionInstall(lines, index, key);
|
|
4541
|
+
if (action !== void 0) {
|
|
4542
|
+
found.push(action);
|
|
4543
|
+
continue;
|
|
4544
|
+
}
|
|
4447
4545
|
if (key !== null) {
|
|
4448
4546
|
from = key[0].length;
|
|
4449
4547
|
const quote = value.charAt(0);
|
|
@@ -4465,6 +4563,10 @@ function filteredInstalls(text) {
|
|
|
4465
4563
|
found.push(...installsOf(pending, editable));
|
|
4466
4564
|
return found;
|
|
4467
4565
|
}
|
|
4566
|
+
/** This function gives the selector of each filtered `pnpm install` of a workflow, from {@link pnpmInstallCommands}. */
|
|
4567
|
+
function filteredInstalls(text) {
|
|
4568
|
+
return pnpmInstallCommands(text).flatMap((install) => install.selectors);
|
|
4569
|
+
}
|
|
4468
4570
|
/** This function gives the selector `<name>...` in the quotes of the old selector, or in double quotes. It gives undefined for a selector in another form. */
|
|
4469
4571
|
function dependencySelector(raw, name) {
|
|
4470
4572
|
if (raw === name) return `"${name}..."`;
|
|
@@ -4592,6 +4694,7 @@ const SHARED_ACTIONS = [
|
|
|
4592
4694
|
"npm-publish",
|
|
4593
4695
|
"pages-build",
|
|
4594
4696
|
"pass-stamp",
|
|
4697
|
+
"pnpm-install",
|
|
4595
4698
|
"pull-of-run",
|
|
4596
4699
|
"release-check",
|
|
4597
4700
|
"security-scan",
|
|
@@ -4608,7 +4711,7 @@ const SHARED_ACTIONS = [
|
|
|
4608
4711
|
/** The `uses` value of a job that calls the shared CI, with no pin. */
|
|
4609
4712
|
const SHARED_CI = "mark1russell7/template/.github/workflows/reusable-ci.yml";
|
|
4610
4713
|
/** The action folder of a path: `.github/actions/<name>/action.yml` gives `<name>`. */
|
|
4611
|
-
const ACTION$
|
|
4714
|
+
const ACTION$5 = /^\.github\/actions\/([^/]+)\//;
|
|
4612
4715
|
/** The file name of a path. */
|
|
4613
4716
|
const baseName = (path) => path.slice(path.lastIndexOf("/") + 1);
|
|
4614
4717
|
/** This function tells if a job of a workflow text uses the shared CI of the template. */
|
|
@@ -4672,7 +4775,7 @@ const sharedCi = {
|
|
|
4672
4775
|
});
|
|
4673
4776
|
const actions = /* @__PURE__ */ new Set();
|
|
4674
4777
|
for (const file of files) {
|
|
4675
|
-
const folder = ACTION$
|
|
4778
|
+
const folder = ACTION$5.exec(file)?.[1];
|
|
4676
4779
|
if (folder !== void 0 && SHARED_ACTIONS.includes(folder) && !actions.has(folder)) {
|
|
4677
4780
|
actions.add(folder);
|
|
4678
4781
|
breaks.push({
|
|
@@ -76540,7 +76643,7 @@ function movedTo(repo, moves) {
|
|
|
76540
76643
|
* Each run of the workflow then fails before it starts ("workflow file issue"), and no job shows why.
|
|
76541
76644
|
*/
|
|
76542
76645
|
/** The files of a composite action. */
|
|
76543
|
-
const ACTION$
|
|
76646
|
+
const ACTION$4 = /^\.github\/actions\/.+\/action\.ya?ml$/;
|
|
76544
76647
|
/** The value of `uses:` that names another repository: `owner/name`, then a path or nothing, then `@` and the ref. */
|
|
76545
76648
|
const REMOTE = /^([\w.-]+)\/([\w.-]+)(\/[^@\s]*)?@\S+$/;
|
|
76546
76649
|
/** This function gives each `uses:` of a workflow or an action that names another repository. A local path (`./`) and a Docker image (`docker://`) are not calls of a repository. */
|
|
@@ -76596,7 +76699,7 @@ const movedRepoCalls = {
|
|
|
76596
76699
|
if (bad !== void 0) return { skipped: `the option moves has "${bad.text}", which is not in the form owner/name=owner/name` };
|
|
76597
76700
|
const moves = [...MOVES, ...extra.map((each) => each.move)];
|
|
76598
76701
|
const breaks = [];
|
|
76599
|
-
for (const file of files.filter((path) => WORKFLOW$1.test(path) || ACTION$
|
|
76702
|
+
for (const file of files.filter((path) => WORKFLOW$1.test(path) || ACTION$4.test(path)).sort(byCode)) {
|
|
76600
76703
|
let text;
|
|
76601
76704
|
try {
|
|
76602
76705
|
text = readFileSync(join(context.root, file), "utf8");
|
|
@@ -76699,7 +76802,7 @@ const MANIFEST = /(^|\/)package\.json$/;
|
|
|
76699
76802
|
const MARKDOWN = /\.mdx?$/i;
|
|
76700
76803
|
const CHANGELOG = /(^|\/)CHANGELOG\.md$/i;
|
|
76701
76804
|
/** A file of a composite action. */
|
|
76702
|
-
const ACTION$
|
|
76805
|
+
const ACTION$3 = /^\.github\/actions\/.+\/action\.ya?ml$/;
|
|
76703
76806
|
/** The kinds of place of the core, in the order of a report. */
|
|
76704
76807
|
const PLACE_KINDS = [
|
|
76705
76808
|
{
|
|
@@ -76717,7 +76820,7 @@ const PLACE_KINDS = [
|
|
|
76717
76820
|
{
|
|
76718
76821
|
id: "workflow-names",
|
|
76719
76822
|
title: "The addresses and each key repository of a workflow or a composite action, except uses: (the rule moved-repo-calls).",
|
|
76720
|
-
reads: (file) => WORKFLOW$1.test(file) || ACTION$
|
|
76823
|
+
reads: (file) => WORKFLOW$1.test(file) || ACTION$3.test(file),
|
|
76721
76824
|
find: (text) => {
|
|
76722
76825
|
const skip = (line) => line.trimStart().startsWith("#") || keyValue(line, "uses") !== void 0;
|
|
76723
76826
|
const keys = [];
|
|
@@ -79248,6 +79351,10 @@ const SITE_CONFIG_KEYS = {
|
|
|
79248
79351
|
kind: "string",
|
|
79249
79352
|
default: ""
|
|
79250
79353
|
},
|
|
79354
|
+
"site-check-wide-font": {
|
|
79355
|
+
kind: "string",
|
|
79356
|
+
default: ""
|
|
79357
|
+
},
|
|
79251
79358
|
"site-check-playwright": {
|
|
79252
79359
|
kind: "string",
|
|
79253
79360
|
default: "1.64.1"
|
|
@@ -80121,9 +80228,9 @@ const jobFails = {
|
|
|
80121
80228
|
* more try. A bare `playwright install --with-deps` waits for the package mirror with no limit.
|
|
80122
80229
|
*/
|
|
80123
80230
|
/** The files of a composite action. */
|
|
80124
|
-
const ACTION$
|
|
80231
|
+
const ACTION$2 = /^\.github\/actions\/.+\/action\.ya?ml$/;
|
|
80125
80232
|
/** The folder of the action of the template itself. It is the one place with the install. */
|
|
80126
|
-
const SHARED_ACTION = ".github/actions/setup-playwright/";
|
|
80233
|
+
const SHARED_ACTION$1 = ".github/actions/setup-playwright/";
|
|
80127
80234
|
/**
|
|
80128
80235
|
* A command of the Playwright CLI that installs: `install` or `install-deps`. The CLI comes first on the line, or after a
|
|
80129
80236
|
* space or a shell operator. It can have a folder and a version, as in `node_modules/.bin/playwright` or
|
|
@@ -80198,7 +80305,7 @@ const playwrightInstall = {
|
|
|
80198
80305
|
return;
|
|
80199
80306
|
}
|
|
80200
80307
|
};
|
|
80201
|
-
for (const file of files.filter((path) => (WORKFLOW$1.test(path) || ACTION$
|
|
80308
|
+
for (const file of files.filter((path) => (WORKFLOW$1.test(path) || ACTION$2.test(path)) && !path.startsWith(SHARED_ACTION$1)).sort(byCode)) {
|
|
80202
80309
|
const text = read(file);
|
|
80203
80310
|
if (text === void 0) continue;
|
|
80204
80311
|
for (const install of playwrightInstalls(text)) breaks.push({
|
|
@@ -80219,6 +80326,96 @@ const playwrightInstall = {
|
|
|
80219
80326
|
return breaks;
|
|
80220
80327
|
}
|
|
80221
80328
|
};
|
|
80329
|
+
// src/rules/pnpm-install.ts
|
|
80330
|
+
/**
|
|
80331
|
+
* The rule `pnpm-install`: no workflow or action starts `pnpm install` in its own step. The shared action
|
|
80332
|
+
* `pnpm-install` of the template gives each try a time limit. After a failure or a stop, the next try starts. A bare
|
|
80333
|
+
* install waits until the limit of the job when a fetch from the npm registry stalls. In a job with a default folder
|
|
80334
|
+
* (`defaults.run.working-directory`), a step of the action gives that folder to its input `working-directory`. A step
|
|
80335
|
+
* `uses` does not take the default folder.
|
|
80336
|
+
*/
|
|
80337
|
+
/** The files of a composite action. */
|
|
80338
|
+
const ACTION$1 = /^\.github\/actions\/.+\/action\.ya?ml$/;
|
|
80339
|
+
/** The action of the template itself. Its step for an old Node.js starts one install with no time limit. */
|
|
80340
|
+
const SHARED_ACTION = ".github/actions/pnpm-install/action.yml";
|
|
80341
|
+
/** The action of a step, with no pin: the action `pnpm-install` of the template, or a copy of the template at a path. */
|
|
80342
|
+
const ACTION_USES = /(?:^|\/)\.github\/actions\/pnpm-install$/;
|
|
80343
|
+
/**
|
|
80344
|
+
* This function gives each step of the action `pnpm-install` with no input `working-directory` in a job with a default
|
|
80345
|
+
* folder other than the root. A file that does not parse gives none: the rule `workflow-parses` reports it.
|
|
80346
|
+
*/
|
|
80347
|
+
function lostFolders(file, text) {
|
|
80348
|
+
const found = [];
|
|
80349
|
+
for (const job of parseWorkflow(file, text).jobs) {
|
|
80350
|
+
const folder = job.defaultDirectory;
|
|
80351
|
+
if (folder === "" || folder === ".") continue;
|
|
80352
|
+
for (const step of job.steps) if (ACTION_USES.test(step.uses) && step.with["working-directory"] === void 0) found.push({
|
|
80353
|
+
line: step.line,
|
|
80354
|
+
job: job.id,
|
|
80355
|
+
folder
|
|
80356
|
+
});
|
|
80357
|
+
}
|
|
80358
|
+
return found;
|
|
80359
|
+
}
|
|
80360
|
+
/**
|
|
80361
|
+
* This function gives each `pnpm install` of a workflow or an action outside the action `pnpm-install`. The reader of
|
|
80362
|
+
* the rule `filtered-install` finds them. It does not read a comment, a quote or a name.
|
|
80363
|
+
*/
|
|
80364
|
+
function bareInstalls(text) {
|
|
80365
|
+
return pnpmInstallCommands(text).filter((install) => !install.action).map((install) => ({
|
|
80366
|
+
line: install.line,
|
|
80367
|
+
command: install.words.join(" ")
|
|
80368
|
+
}));
|
|
80369
|
+
}
|
|
80370
|
+
const pnpmInstall = {
|
|
80371
|
+
id: "pnpm-install",
|
|
80372
|
+
title: "pnpm install runs in the shared action `pnpm-install`, which gives each try a time limit, not in a step `run: pnpm install`.",
|
|
80373
|
+
reason: "A fetch from the npm registry stalls at times. A bare pnpm install then waits until the limit of the job. On 2026-12-02 the downloads of two packages stayed at 0 B in two jobs of client and in one job of TinyImages. Each job waited 15 or 25 minutes and failed. An install from the cache takes seconds: in 25 runs of each of five repositories, the slowest took 18 seconds.",
|
|
80374
|
+
fix: "Use the step `uses: mark1russell7/template/.github/actions/pnpm-install@<commit>` in place of `run: pnpm install`. Its input `args` gives the words after `pnpm install` (the default is `--frozen-lockfile`), and its input `working-directory` gives the folder. The other commands of the step stay in a step `run`. In a job with `defaults.run.working-directory`, give the same folder to the input `working-directory`: a step `uses` does not take the default folder.",
|
|
80375
|
+
sources: [
|
|
80376
|
+
{
|
|
80377
|
+
repo: "client",
|
|
80378
|
+
rule: "ci",
|
|
80379
|
+
doc: "run 46854685048 (2026-12-02): pnpm install --frozen-lockfile stalled in two jobs, and each job waited until its limit"
|
|
80380
|
+
},
|
|
80381
|
+
{
|
|
80382
|
+
repo: "TinyImages",
|
|
80383
|
+
rule: "ci",
|
|
80384
|
+
doc: "run 46853586975 (2026-12-02): the same stall, at the same hour"
|
|
80385
|
+
},
|
|
80386
|
+
{
|
|
80387
|
+
repo: "template",
|
|
80388
|
+
rule: "pnpm-install",
|
|
80389
|
+
doc: "the shared action pnpm-install: a time limit of 3 minutes on each try, and 3 tries"
|
|
80390
|
+
}
|
|
80391
|
+
],
|
|
80392
|
+
options: {},
|
|
80393
|
+
failsFrom: "2026-12-28",
|
|
80394
|
+
check(context) {
|
|
80395
|
+
const files = context.gitFiles();
|
|
80396
|
+
if (files === void 0) return { skipped: "the root is not in a git repository" };
|
|
80397
|
+
const breaks = [];
|
|
80398
|
+
for (const file of files.filter((path) => (WORKFLOW$1.test(path) || ACTION$1.test(path)) && path !== SHARED_ACTION).sort(byCode)) {
|
|
80399
|
+
let text;
|
|
80400
|
+
try {
|
|
80401
|
+
text = readFileSync(join(context.root, file), "utf8");
|
|
80402
|
+
} catch {
|
|
80403
|
+
continue;
|
|
80404
|
+
}
|
|
80405
|
+
if (WORKFLOW$1.test(file)) for (const lost of lostFolders(file, text)) breaks.push({
|
|
80406
|
+
file,
|
|
80407
|
+
line: lost.line,
|
|
80408
|
+
message: `${file} starts the action pnpm-install in the job ${lost.job} with no input working-directory. A step "uses" does not take the default folder ${lost.folder} of the job, so the install runs at the root of the checkout. Give the folder to the input working-directory.`
|
|
80409
|
+
});
|
|
80410
|
+
for (const install of bareInstalls(text)) breaks.push({
|
|
80411
|
+
file,
|
|
80412
|
+
line: install.line,
|
|
80413
|
+
message: `${file} starts "${install.command}" in a step of its own. A stalled fetch then holds the job, with no next try. Use the action pnpm-install of the template.`
|
|
80414
|
+
});
|
|
80415
|
+
}
|
|
80416
|
+
return breaks;
|
|
80417
|
+
}
|
|
80418
|
+
};
|
|
80222
80419
|
// src/rules/unreleased-change.ts
|
|
80223
80420
|
/**
|
|
80224
80421
|
* The rule `unreleased-change`: a change does not set a version that npm has. With the option `versionEachChange`, a
|
|
@@ -83510,6 +83707,7 @@ const RULES = [
|
|
|
83510
83707
|
setupCue,
|
|
83511
83708
|
setupPnpm,
|
|
83512
83709
|
filteredInstall,
|
|
83710
|
+
pnpmInstall,
|
|
83513
83711
|
playwrightInstall,
|
|
83514
83712
|
movedRepoCalls,
|
|
83515
83713
|
movedRepoNames,
|
|
@@ -84731,6 +84929,6 @@ function runHook(args, io) {
|
|
|
84731
84929
|
git: (gitArgs) => runGit(io.cwd, gitArgs)
|
|
84732
84930
|
}, io);
|
|
84733
84931
|
}
|
|
84734
|
-
export { retiredFile as $,
|
|
84932
|
+
export { retiredFile as $, SHARED_CI as $n, readWorkflow as $r, lineNameHit as $t, scriptsOf as A, declaredName as An, withOneJob as Ar, pushMainOnly as At, giveWaySlots as B, mapMarkdown as Bn, convertGate as Br, PRIVATE_NAMES_FILE_VARIABLE as Bt, setVersions as C, parseRuleConfig as Ci, shapesOfSource as Cn, startsOnPullRequest as Cr, gitPinOnNpm as Ct, trustPolicy as D, moduleMessage as Dn, SECURITY_TIMEOUT_MINUTES as Dr, pinnedGitDeps as Dt, TRAIN_SCOPES as E, homeModule as En, SECURITY_SCAN_INPUTS as Er, isPinned as Et, sourceMain as F, signaturesOf as Fn, licenseFile as Fr, publishTextSafe as Ft, workflowPeaks as G, npmPackagesOf as Gn, summaryName as Gr, privateNamesFiles as Gt, repositoryPeak as H, mergeHomes as Hn, prPathFilters as Hr, invalidPatternBreaks as Ht, TEMPLATE_CALLED as I, HOME_EXPORTS as In, licenseFileOf as Ir, packNoBuildinfo as It, mayRun as J, runCalls as Jn, gateAfterCancel as Jr, PRIVATE_NAME_LIST as Jt, evaluateExpression as K, readOverlay as Kn, JOB_LIMIT_FLOOR_MINUTES as Kr, privatePatterns as Kt, UNKNOWN_MATRIX_JOBS as L, HOMES as Ln, mitText as Lr, DEFAULT_ALLOWED as Lt, testsRequired as M, messageOf$1 as Mn, scheduleMinute as Mr, pagesCalls as Mt, isSourcePath as N, repoOf as Nn, LICENSE_TEXTS as Nr, pagesSite as Nt, typedScripts as O, moduleUses as On, securityCallers as Or, siteCheckInCi as Ot, pathsOf as P, reposOf as Pn, authorOf as Pr, exportsRequire as Pt, RETIRED_FILES as Q, SHARED_ACTIONS as Qn, readAction as Qr, isCommonUse as Qt, calledJobs as R, MAP_RULE as Rn, repositoryIsPublic as Rr, HOME_PATTERNS as Rt, namedVersions as S, parseConfig as Si, shapeMessage as Sn, hasSummaryJob as Sr, pnpmYamlParses as St, IGNORE_AFTER as T, HOME_SHAPES as Tn, SECURITY_SCAN_COMMIT as Tr, isGitSpecifier as Tt, runnerPeak as U, npmDrift as Un, skippableJobs as Ur, noLocalPaths as Ut, matrixPeak as V, mapText as Vn, gateTrigger as Vr, PRIVATE_PATTERNS_VARIABLE as Vt, runsAtOnce as W, npmNames as Wn, summaryJob as Wr, privateNamesFile as Wt, roadmapParses as X, hasTests as Xn, MATRIX_EXPAND_MAX as Xr, firstNameMatch as Xt, roadmapOfLine as Y, serviceRunMain as Yn, FILTER_KEYS as Yr, PrivateNameListError as Yt, retiredFiles as Z, tsconfigTest as Zn, parseWorkflow as Zr, isAllowedHit as Zt, runPrePushArgs as _, runGit as _i, coverageProvider as _n, isSecurityGate as _r, parseAdvisory as _t, listRules as a, cleanPath as ai, CONSOLE_LAST_DAY as an, setupCue as ar, publishedMinorRule as at, GITHUB_YAML as b, specifiersOf as bi, homeShape as bn, SUMMARY_GATES as br, pipeFails as bt, runCli as c, inFolder as ci, consoleGate as cn, HOME_TIMEOUT_MS as cr, SHIPPED_FIELDS as ct, HOOK_MARKER as d, matchesAny as di, isConsoleSource as dn, sharedDocsRule as dr, unreleasedChange as dt, yamlFaults as ei, lineNameHits as en, SHARED_WORKFLOWS as er, requiredScripts as et, NO_READ_LINE as f, parseCatFileBatch as fi, noConsole as fn, addReleaseMode as fr, unreleasedChangeRule as ft, prePush as g, repositoryOfRemote as gi, mainCheck as gn, SECURITY_FILE as gr, jobFails as gt, parsePrePushArgs as h, replaceLine as hi, hasImportMetaMain as hn, releaseModeRule as hr, hiddenFailures as ht, formatResult as i, RULE_WARN_DAYS as ii, pathNameHit as in, setupPnpm as ir, publishedMinor as it, typedFiles as j, homePackage as jn, runnerBudget as jr, PAGES_WORKFLOWS as jt, configsOfScript as k, modulesOf as kn, securityOneJob as kr, pagesAfterRelease as kt, runFix as l, keyLine as li, consoleKind as ln, blockHash as lr, UNSHIPPED_FILES as lt, installHook as m, readJsonc as mi, REAL_COMPARE as mn, hasReleaseMode as mr, playwrightInstall as mt, annotations as n, cuePreset as ni, nameMatches as nn, sharedCi as nr, lockedVersions as nt, readConfig as o, codePackages as oi, NOT_SOURCE as on, callPermissions as or, reachOf as ot, PRE_PUSH_HOOK as p, parseJsonc as pi, noBuildOutput as pn, callsReleaseBuild as pr, pnpmInstall as pt, groupParts as q, SERVICE_PACKAGE as qn, jobLimitFloor as qr, privateTextBreaks as qt, createContext as r, DEPENDENCY_FIELDS as ri, parsePrivateNames as rn, filteredInstall as rr, minorOf as rt, runChecks as s, hasFile as si, consoleBreaks as sn, callPermissionsRule as sr, NPM_REGISTRY as st, USAGE as t, STRICT_OPTIONS as ti, mergePrivateNames as tn, callsSharedCi as tr, releaseFiles as tt, summaryMarkdown as u, lineOf as ui, isCliFile as un, githubFetch as ur, npmLookup as ut, RULES as v, runGitShow as vi, apiReportScript as vn, securityGate as vr, startsTests as vt, versionTitle as w, spansOf as wn, summaryJobRule as wr, dependencySpecifiers as wt, workflowParses as x, defaultOptions as xi, homeShapesOf as xn, addSummaryJob as xr, PNPM_YAML as xt, workspaceProtocol as y, showFiles as yi, containedHome as yn, securityWorkflow as yr, swallowsTests as yt, eventClass as z, findHomes as zn, ACTIONS_COMMIT as zr, PRIVATE_NAMES_FILE_CONFIG as zt };
|
|
84735
84933
|
|
|
84736
|
-
//# sourceMappingURL=run-
|
|
84934
|
+
//# sourceMappingURL=run-CeEPIgVg.js.map
|