@mark1russell7/conventions 0.31.0 → 0.32.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 +2 -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-BzGyrL7o.js → run-D0rhX3d_.js} +95 -3
- package/build/run-D0rhX3d_.js.map +1 -0
- package/package.json +2 -2
- package/build/run-BzGyrL7o.js.map +0 -1
package/README.md
CHANGED
|
@@ -26,6 +26,7 @@ Each break shows the file, the line, the rule and the fix. In GitHub Actions, th
|
|
|
26
26
|
- `main-runs-finish`: a `cancel-in-progress: true` or a concurrency group that ends with `${{ github.ref }}`, in a workflow that starts on `push` or on `workflow_call`. The fix writes `${{ github.event_name == 'pull_request' }}` and `${{ github.event_name == 'pull_request' && github.ref || github.sha }}`.
|
|
27
27
|
- `push-main-only`: a workflow that starts on `push` and on `pull_request`, with no limit of `push` to the default branch or with no `workflow_dispatch`. The fix adds `branches` and `workflow_dispatch`, and keeps the comments and each other trigger. It keeps a tag run when the workflow reads the tag. It does not edit `release.yml`, and a person chooses the change for `branches-ignore` or for another named branch.
|
|
28
28
|
- `pipe-fails`: a step with a pipe and no `pipefail`. The fix adds `defaults: { run: { shell: bash } }` to the workflow. It does not write over another shell.
|
|
29
|
+
- `gate-after-cancel`: a summary job of a gate with `always()` in its condition. The fix writes `if: ${{ !cancelled() }}`. A condition with other parts needs a person.
|
|
29
30
|
- `tests-required`: the option `passWithNoTests` in a config or a script, in a package with test files. A package with no tests needs a person, who removes its test script.
|
|
30
31
|
- `typed-files`: a config file at the root of a package (`vitest.config.ts`). The fix adds `*.config.ts` and `rootDir: "."` to the `tsconfig.test.json` of the package, when that file has no comments.
|
|
31
32
|
- `trust-policy`: the settings `trustPolicy`, `trustPolicyIgnoreAfter` and `trustPolicyExclude` of `pnpm-workspace.yaml`. The fix makes the file when the repository has none.
|
|
@@ -62,6 +63,7 @@ The rules come from the invariants audit of 2026-10-26 (strategy item s38). The
|
|
|
62
63
|
| `main-runs-finish` | A workflow that starts on `push` or on `workflow_call` does not cancel a run in progress. A called workflow gets the event of its caller. A newer push cancels only the run of a pull request: `cancel-in-progress: ${{ github.event_name == 'pull_request' }}`. Each commit of `main` has its own concurrency group: `${{ github.event_name == 'pull_request' && github.ref || github.sha }}`. In one group, GitHub cancels a run that waits when a newer run comes, whatever `cancel-in-progress` says. On 2026-11-03 four waiting CI runs of `main` in client were cancelled, so its version commit had no result and no release. On 2026-11-03 the next merge cancelled the CI run of a commit on `main`, so the main check of that commit had no result. A bench run on `main` was cancelled too, and its claim had no measurement. | private `main-runs-finish` (STRATEGY.md, 2026-11-03). |
|
|
63
64
|
| `push-main-only` | A workflow that starts on `push` and on `pull_request` limits `push` to the default branch with `branches`, and has `workflow_dispatch`. Without the limit, each commit of a pull request starts two runs. A `push` with only a tag filter, a `pull_request` with `types` that do not have `synchronize`, and `pull_request_target` are not breaks. `CI.md` tells each case in "One run for each commit". |
|
|
64
65
|
| `pipe-fails` | A failure on the left of a pipe fails its step. With no `shell` key, GitHub has no `pipefail`, so `tests \| tee out.txt` passes when the tests fail. The fix adds `shell: bash` as the default of the workflow. A step that then turns red had a failure that the pipe hid. |
|
|
66
|
+
| `gate-after-cancel` | A summary job of a gate has the condition `if: ${{ !cancelled() }}`, not `always()`. After a cancel, a job with `always()` asks for a runner, and the new run waits behind it. A job with `!cancelled()` concludes `cancelled` with no runner, and the pull request stays blocked. |
|
|
65
67
|
| `gate-trigger` | No workflow has `paths` or `paths-ignore` on `on.pull_request` or `on.pull_request_target`. The ruleset needs the summary check `<Name> OK` of each gate, and a workflow with a path filter does not start on each pull request. Then its check is not there, the ruleset cannot ask for it, and a pull request can merge before the gate ends. A gate uses the actions `changes` and `gate-summary` of the template (`CI.md`, "A gate with paths"). | private `gate-trigger` (STRATEGY.md, 2026-11-02). |
|
|
66
68
|
| `license-file` | Each public package has a license field, and a license file with the same license in its own folder. A public repository, or a repository with a public package, has a license file at its root. In a GitHub Actions run, the event file tells if the repository is public, and the option `license` (MIT by default) is the license of a root with no public package. npm packs only the license file of the folder of the package, and GitHub reads only the one of the root: on 2026-11-02 five public repositories showed no license on GitHub while npm said MIT. `conventions fix` writes the missing files. | private strategy (2026-11-02). |
|
|
67
69
|
| `home-package` | A change does not add a function with a signature name of another home of the map (for example `median`, `mulberry32` or `writeFileAtomic`). A local copy drifts from the home and splits the fixes. On 2026-11-02 the repositories had 68 local statistics functions in 14 repositories. The rule examines only the lines that the change adds, so the copies that exist do not break. | private direction 18 (STRATEGY.md, 2026-11-02). |
|
package/build/cli.js
CHANGED
package/build/index.d.ts
CHANGED
|
@@ -157,6 +157,7 @@ export declare function parseConfig(value: unknown, rules: readonly Rule[]): Con
|
|
|
157
157
|
/** The compiler options that make the type check strict. A package does not turn them off. */
|
|
158
158
|
export declare const STRICT_OPTIONS: readonly ["strict", "noImplicitAny", "strictNullChecks", "strictFunctionTypes", "strictBindCallApply", "strictPropertyInitialization", "strictBuiltinIteratorReturn", "noImplicitThis", "useUnknownInCatchVariables", "alwaysStrict", "noUncheckedIndexedAccess", "exactOptionalPropertyTypes", "noImplicitOverride", "noImplicitReturns", "noFallthroughCasesInSwitch", "noPropertyAccessFromIndexSignature", "erasableSyntaxOnly"];
|
|
159
159
|
export declare const cuePreset: Rule;
|
|
160
|
+
export declare const gateAfterCancel: Rule;
|
|
160
161
|
/** A path filter of a pull request trigger: the line (from 1), the trigger and the key. */
|
|
161
162
|
interface PathFilter {
|
|
162
163
|
readonly line: number;
|
package/build/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","names":[],"sources":["../src/rule.ts","../src/config.ts","../src/rules/cue-preset.ts","../src/rules/gate-trigger.ts","../src/map.ts","../src/rules/home-package.ts","../src/rules/license-file.ts","../src/rules/main-check.ts","../src/rules/no-build-output.ts","../src/rules/no-local-paths.ts","../src/rules/api-report-script.ts","../src/rules/pages-after-release.ts","../src/rules/pages-site.ts","../src/rules/pinned-git-deps.ts","../src/rules/pipe-fails.ts","../src/rules/push-main-only.ts","../src/rules/unreleased-change.ts","../src/rules/published-minor.ts","../src/rules/release-files.ts","../src/rules/required-scripts.ts","../src/rules/roadmap-parses.ts","../src/rules/runner-budget.ts","../src/rules/shared-docs.ts","../src/rules/source-main.ts","../src/rules/tests-required.ts","../src/rules/tsconfig-test.ts","../src/rules/typed-files.ts","../src/rules/typed-scripts.ts","../src/rules/trust-policy.ts","../src/rules/workspace-protocol.ts","../src/rules/index.ts","../src/home-exports.ts","../src/workflow.ts","../src/run.ts","../src/release-text.ts","../src/workspace.ts"],"mappings":";UASiB;WACN;WACA;WACA;;;UAIM;;WAEN;;WAEA;WACA;;WAEA;;WAEA,iBAAiB;;;;;;UAOX;;WAEN;;WAEA;;WAEA;;;wBAIK,YAAY,cAAc,cAAc;;KAQ5C;;KAGA,UAAU,SAAS,eAAe;;UAG7B;WACN;WACA,SAAS;WACT;;;KAIC,WAAW,SAAS;;UAGf;;WAEN;;WAEA;;WAEA;;WAEA;WACA,UAAU;;;UAIJ;;WAEN;;WAEA,aAAa;;WAEb,mBAAmB;;WAEnB,KAAK,SAAS;;WAEd;;EAET;;EAEA,IAAI;;;KAIM,uBAAuB;WAAqB;;;UAGvC;;WAEN;;WAEA;;WAEA;;WAEA;;WAEA,kBAAkB;;WAElB,SAAS,SAAS,eAAe;;;;;WAKjC;EACT,MAAM,SAAS,aAAa,SAAS,UAAU;;;qBAIpC;;wBAGG,aAAa,UAAU,UAAU;;wBAOjC,OAAO,cAAc,gBAAgB;;wBAOrC,QAAQ,cAAc,eAAe;;qBAMxC,WAAY,gBAAgB;;qBAG5B,YAAa;;wBAGV,WAAW,cAAc;;;;;;wBASzB,WAAW;;wBA2BX,UAAU;;wBAUV,OAAO,cAAc;;qBAOxB,UAAW,aAAa;;;;;wBAMrB,aAAa,SAAS,KAAK,oDAAoD;;UC1M9E;;WAEN;;WAEA;;WAEA;;WAEA,SAAS;;;UAIH;;WAEN;;WAEA,OAAO,SAAS,eAAe;;;wBAW1B,eAAe,MAAM,OAAO;;;;;;;wBAU5B,YAAY,gBAAgB,gBAAgB,SAAS;;qBCnCxD;qBA4FA,WAAW;;
|
|
1
|
+
{"version":3,"file":"index.d.ts","names":[],"sources":["../src/rule.ts","../src/config.ts","../src/rules/cue-preset.ts","../src/rules/gate-after-cancel.ts","../src/rules/gate-trigger.ts","../src/map.ts","../src/rules/home-package.ts","../src/rules/license-file.ts","../src/rules/main-check.ts","../src/rules/no-build-output.ts","../src/rules/no-local-paths.ts","../src/rules/api-report-script.ts","../src/rules/pages-after-release.ts","../src/rules/pages-site.ts","../src/rules/pinned-git-deps.ts","../src/rules/pipe-fails.ts","../src/rules/push-main-only.ts","../src/rules/unreleased-change.ts","../src/rules/published-minor.ts","../src/rules/release-files.ts","../src/rules/required-scripts.ts","../src/rules/roadmap-parses.ts","../src/rules/runner-budget.ts","../src/rules/shared-docs.ts","../src/rules/source-main.ts","../src/rules/tests-required.ts","../src/rules/tsconfig-test.ts","../src/rules/typed-files.ts","../src/rules/typed-scripts.ts","../src/rules/trust-policy.ts","../src/rules/workspace-protocol.ts","../src/rules/index.ts","../src/home-exports.ts","../src/workflow.ts","../src/run.ts","../src/release-text.ts","../src/workspace.ts"],"mappings":";UASiB;WACN;WACA;WACA;;;UAIM;;WAEN;;WAEA;WACA;;WAEA;;WAEA,iBAAiB;;;;;;UAOX;;WAEN;;WAEA;;WAEA;;;wBAIK,YAAY,cAAc,cAAc;;KAQ5C;;KAGA,UAAU,SAAS,eAAe;;UAG7B;WACN;WACA,SAAS;WACT;;;KAIC,WAAW,SAAS;;UAGf;;WAEN;;WAEA;;WAEA;;WAEA;WACA,UAAU;;;UAIJ;;WAEN;;WAEA,aAAa;;WAEb,mBAAmB;;WAEnB,KAAK,SAAS;;WAEd;;EAET;;EAEA,IAAI;;;KAIM,uBAAuB;WAAqB;;;UAGvC;;WAE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,SAAS;WAA0B;WAA0B;;UC6EvE;WACN;WACA;WACA;;WAEA;WACA;;;UAIM;;WAEN;;WAEA;;WAEA;;;UAIM;WACN;WACA;WACA;WACA,gBAAgB;;;UAIV;;WAEN;;WAEA;;WAEA;WACA,iBAAiB;WACjB,eAAe;;;wBAgGV,aAAa,cAAc,eAAe;;UCrMzC;WACN;WACA;WACA;;WAEA;WACA,iBAAiB;;WAEjB;;WAEA;;;UAIM;WACN,gBAAgB;;WAEhB;;;UAIM;;WAEN;;WAEA;;WAEA;WACA,MAAM,SAAS;;WAEf,iBAAiB;;;wBAaZ,WAAW,cAAc,iBAAgB,SAAiB;;wBAO1D,cAAc,cAAc,QAAQ,mBAAmB,UAAS,KAAK,gCAAqC;;wBAwB1G,UAAU,SAAS,eAAe;;UAmDjC;;WAEN;;WAEA;;WAEA,QAAQ;;;;;;;wBAWH,OAAO,SAAS,eAAe;;wBAyC/B,aAAa,QAAQ;;wBA0BrB,gBAAgB,QAAQ;;wBAsBxB,YAAY,QAAQ;;wBAYpB,UAAU,QAAQ,+BAA+B,iBAAgB;;UAkBhE;WACN;WACA,KAAK,SAAS;WACd,SAAS;WACT,SAAS;;;qBAIP;;wBA6CG,OAAO,yBAAyB,IAAI;;;;;;;;qBChUvC;;wBAGG,QAAQ,cAAc,iBAAiB;;;;;;;;wBAavC,iBAAiB,kBAAkB,iBAAiB;;wBA+BpD,OAAO,cAAc;;;;;wBAQrB,aAAa,cAAc,iBAAiB;;;;;;wBCzC5C,aAAa,eAAe;;;;;wBAsD5B,YAAY,cAAc;;;;;;wBA8B1B,eAAe;;;;;;;wBAwCf,eAAe,cAAc"}
|
package/build/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { $ as pushMainOnly, $t as
|
|
1
|
+
import { $ as pushMainOnly, $t as globToRegExp, A as roadmapOfLine, At as ACTIONS_COMMIT, B as SHIPPED_FIELDS, Bt as cleanPath, C as isSourcePath, Ct as MAP_RULE, D as blockHash, Dt as mergeHomes, E as HOME_TIMEOUT_MS, Et as mapText, F as minorOf, Ft as gateAfterCancel, G as pipeFails, Gt as lineOf, H as npmLookup, Ht as hasFile, I as publishedMinor, It as readWorkflow, J as pinnedGitDeps, Jt as readJsonc, K as isGitSpecifier, Kt as matchesAny, L as publishedMinorRule, Lt as STRICT_OPTIONS, M as requiredScripts, Mt as gateTrigger, N as releaseFiles, Nt as prPathFilters, O as githubFetch, Ot as readOverlay, P as lockedVersions, Pt as summaryName, Q as scheduleMinute, Qt as globFolders, R as reachOf, Rt as cuePreset, S as tsconfigTest, St as HOMES, T as sourceMain, Tt as mapMarkdown, U as unreleasedChange, Ut as inFolder, V as UNSHIPPED_FILES, Vt as codePackages, W as unreleasedChangeRule, Wt as keyLine, X as repositoryOfRemote, Xt as runGit, Y as pagesAfterRelease, Yt as replaceLine, Z as runnerBudget, Zt as specifiersOf, _ as configsOfScript, _t as declaredName, a as listRules, at as HOME_PATTERNS, b as testsRequired, bt as repoOf, c as runCli, ct as REAL_COMPARE, d as RULES, dt as LICENSE_TEXTS, en as packageFolders, et as PAGES_WORKFLOWS, f as workspaceProtocol, ft as authorOf, g as typedScripts, gt as repositoryIsPublic, h as trustPolicy, ht as mitText, i as formatResult, it as DEFAULT_ALLOWED, j as roadmapParses, jt as convertGate, k as sharedDocsRule, kt as HOME_EXPORTS, l as runFix, lt as hasImportMetaMain, m as TRAIN_SCOPES, mt as licenseFileOf, n as annotations, nn as defaultOptions, nt as pagesSite, o as readConfig, ot as noLocalPaths, p as IGNORE_AFTER, pt as licenseFile, q as isPinned, qt as parseJsonc, r as createContext, rn as parseConfig, rt as apiReportScript, s as runChecks, st as noBuildOutput, t as USAGE, tn as workspaceGlobs, tt as pagesCalls, u as summaryMarkdown, ut as mainCheck, v as scriptsOf, vt as homePackage, w as pathsOf, wt as findHomes, x as hasTests, xt as signaturesOf, y as typedFiles, yt as messageOf, z as NPM_REGISTRY, zt as DEPENDENCY_FIELDS } from "./run-D0rhX3d_.js";
|
|
2
2
|
// src/release-text.ts
|
|
3
3
|
/**
|
|
4
4
|
* The rule for the git tag and the text of a GitHub release of a package version.
|
|
@@ -64,6 +64,6 @@ function releaseNotes(name, version, changelog) {
|
|
|
64
64
|
if (section.length <= 1e5) return section;
|
|
65
65
|
return `${section.slice(0, MAX_NOTES)}\n\n(The CHANGELOG.md of \`${name}\` has the full text.)`;
|
|
66
66
|
}
|
|
67
|
-
export { ACTIONS_COMMIT, DEFAULT_ALLOWED, DEPENDENCY_FIELDS, HOMES, HOME_EXPORTS, HOME_PATTERNS, HOME_TIMEOUT_MS, IGNORE_AFTER, LICENSE_TEXTS, MAP_RULE, MAX_NOTES, NPM_REGISTRY, PAGES_WORKFLOWS, REAL_COMPARE, RULES, SHIPPED_FIELDS, STRICT_OPTIONS, TRAIN_SCOPES, UNSHIPPED_FILES, USAGE, annotations, apiReportScript, authorOf, blockHash, changelogSection, cleanPath, codePackages, configsOfScript, convertGate, createContext, cuePreset, declaredName, defaultOptions, findHomes, formatResult, gateTrigger, githubFetch, globFolders, globToRegExp, hasFile, hasImportMetaMain, hasTests, homePackage, inFolder, isGitSpecifier, isPinned, isSourcePath, keyLine, licenseFile, licenseFileOf, lineOf, listRules, lockedVersions, mainCheck, mapMarkdown, mapText, matchesAny, mergeHomes, messageOf, minorOf, mitText, noBuildOutput, noLocalPaths, npmLookup, npmUrl, packageFolders, pagesAfterRelease, pagesCalls, pagesSite, parseConfig, parseJsonc, pathsOf, pinnedGitDeps, pipeFails, prPathFilters, publishedMinor, publishedMinorRule, pushMainOnly, reachOf, readConfig, readJsonc, readOverlay, readWorkflow, releaseFiles, releaseNotes, replaceLine, repoOf, repositoryIsPublic, repositoryOfRemote, requiredScripts, roadmapOfLine, roadmapParses, runChecks, runCli, runFix, runGit, runnerBudget, scheduleMinute, scriptsOf, sharedDocsRule, signaturesOf, sourceMain, specifiersOf, summaryMarkdown, summaryName, tagName, testsRequired, trustPolicy, tsconfigTest, typedFiles, typedScripts, unreleasedChange, unreleasedChangeRule, workspaceGlobs, workspaceProtocol };
|
|
67
|
+
export { ACTIONS_COMMIT, DEFAULT_ALLOWED, DEPENDENCY_FIELDS, HOMES, HOME_EXPORTS, HOME_PATTERNS, HOME_TIMEOUT_MS, IGNORE_AFTER, LICENSE_TEXTS, MAP_RULE, MAX_NOTES, NPM_REGISTRY, PAGES_WORKFLOWS, REAL_COMPARE, RULES, SHIPPED_FIELDS, STRICT_OPTIONS, TRAIN_SCOPES, UNSHIPPED_FILES, USAGE, annotations, apiReportScript, authorOf, blockHash, changelogSection, cleanPath, codePackages, configsOfScript, convertGate, createContext, cuePreset, declaredName, defaultOptions, findHomes, formatResult, gateAfterCancel, gateTrigger, githubFetch, globFolders, globToRegExp, hasFile, hasImportMetaMain, hasTests, homePackage, inFolder, isGitSpecifier, isPinned, isSourcePath, keyLine, licenseFile, licenseFileOf, lineOf, listRules, lockedVersions, mainCheck, mapMarkdown, mapText, matchesAny, mergeHomes, messageOf, minorOf, mitText, noBuildOutput, noLocalPaths, npmLookup, npmUrl, packageFolders, pagesAfterRelease, pagesCalls, pagesSite, parseConfig, parseJsonc, pathsOf, pinnedGitDeps, pipeFails, prPathFilters, publishedMinor, publishedMinorRule, pushMainOnly, reachOf, readConfig, readJsonc, readOverlay, readWorkflow, releaseFiles, releaseNotes, replaceLine, repoOf, repositoryIsPublic, repositoryOfRemote, requiredScripts, roadmapOfLine, roadmapParses, runChecks, runCli, runFix, runGit, runnerBudget, scheduleMinute, scriptsOf, sharedDocsRule, signaturesOf, sourceMain, specifiersOf, summaryMarkdown, summaryName, tagName, testsRequired, trustPolicy, tsconfigTest, typedFiles, typedScripts, unreleasedChange, unreleasedChangeRule, workspaceGlobs, workspaceProtocol };
|
|
68
68
|
|
|
69
69
|
//# sourceMappingURL=index.js.map
|
|
@@ -1528,6 +1528,97 @@ function readWorkflow(file, text) {
|
|
|
1528
1528
|
jobs
|
|
1529
1529
|
};
|
|
1530
1530
|
}
|
|
1531
|
+
// src/rules/gate-after-cancel.ts
|
|
1532
|
+
/**
|
|
1533
|
+
* The rule `gate-after-cancel`: a summary job of a gate does not start after a cancel. A job with `if: always()` still
|
|
1534
|
+
* asks for a runner when its run is cancelled, and the new run of the pull request waits behind it. With `!cancelled()`, the
|
|
1535
|
+
* job concludes `cancelled` with no runner, and it still starts after a failure, a skip and a time limit.
|
|
1536
|
+
*/
|
|
1537
|
+
/** The condition of a summary job. */
|
|
1538
|
+
const NOT_CANCELLED = "${{ !cancelled() }}";
|
|
1539
|
+
const ALWAYS_ONLY = /^(\$\{\{\s*)?always\(\)(\s*\}\})?$/;
|
|
1540
|
+
/** This function tells if a job is a summary job: its name ends with ` OK`, or a step uses the action `gate-summary`. */
|
|
1541
|
+
function isSummary(lines, job) {
|
|
1542
|
+
const end = lines.findIndex((line, at) => at > job && line.trim() !== "" && indentOf$1(line) <= indentOf$1(lines[job] ?? ""));
|
|
1543
|
+
const body = lines.slice(job + 1, end < 0 ? lines.length : end);
|
|
1544
|
+
return childKeys(lines, job).map((at) => keyValue(lines[at] ?? "", "name")).find((value) => value !== void 0)?.endsWith(" OK") === true || body.some((line) => (keyValue(line, "uses") ?? "").includes("/actions/gate-summary@"));
|
|
1545
|
+
}
|
|
1546
|
+
/** This function gives the summary jobs of a workflow with `always()` in the condition of the job. It does not read the condition of a step. */
|
|
1547
|
+
function alwaysGates(text) {
|
|
1548
|
+
const lines = workflowLines(text);
|
|
1549
|
+
const jobs = lines.findIndex((line) => indentOf$1(line) === 0 && keyValue(line, "jobs") !== void 0);
|
|
1550
|
+
if (jobs < 0) return [];
|
|
1551
|
+
const found = [];
|
|
1552
|
+
for (const job of childKeys(lines, jobs)) {
|
|
1553
|
+
if (!isSummary(lines, job)) continue;
|
|
1554
|
+
for (const at of childKeys(lines, job)) {
|
|
1555
|
+
const condition = keyValue(lines[at] ?? "", "if");
|
|
1556
|
+
if (condition === void 0 || !condition.includes("always()")) continue;
|
|
1557
|
+
found.push({
|
|
1558
|
+
line: at,
|
|
1559
|
+
only: ALWAYS_ONLY.test(condition)
|
|
1560
|
+
});
|
|
1561
|
+
}
|
|
1562
|
+
}
|
|
1563
|
+
return found;
|
|
1564
|
+
}
|
|
1565
|
+
/** This function gives the text with `!cancelled()` as the condition of each summary job that has only `always()`. It keeps the line endings and each other line. */
|
|
1566
|
+
function withNotCancelled(text) {
|
|
1567
|
+
const eol = text.includes("\r\n") ? "\r\n" : "\n";
|
|
1568
|
+
const lines = text.split(/\r?\n/);
|
|
1569
|
+
for (const gate of alwaysGates(text)) if (gate.only) lines[gate.line] = `${" ".repeat(indentOf$1(lines[gate.line] ?? ""))}if: ${NOT_CANCELLED}`;
|
|
1570
|
+
return lines.join(eol);
|
|
1571
|
+
}
|
|
1572
|
+
const gateAfterCancel = {
|
|
1573
|
+
id: "gate-after-cancel",
|
|
1574
|
+
title: "A summary job of a gate does not start after a cancel: its condition is `!cancelled()`, not `always()`.",
|
|
1575
|
+
reason: "A job with `if: always()` asks for a runner after a cancel, and the new run waits behind it. On 2026-11-05 a new run waited 22.6 of 23.4 minutes for such jobs of the run that it replaced. A test of each case showed that `!cancelled()` holds the gate: after a cancel the job concludes `cancelled` with no runner, and the pull request stays blocked. After a failure, a skip and a time limit the job starts and fails or passes as before.",
|
|
1576
|
+
fix: "Write `if: ${{ !cancelled() }}` in the summary job. Do not add other parts to this condition: a job that an `if` skips counts as a pass for a required check.",
|
|
1577
|
+
sources: [
|
|
1578
|
+
{
|
|
1579
|
+
repo: "highways",
|
|
1580
|
+
rule: "ci",
|
|
1581
|
+
doc: "runs 41971833871 and 41978983438 (2026-11-05): the new run waited behind the summary jobs of the cancelled run"
|
|
1582
|
+
},
|
|
1583
|
+
{
|
|
1584
|
+
repo: "client",
|
|
1585
|
+
rule: "ci",
|
|
1586
|
+
doc: "ci.yml (2026-11-05): the job CI OK has if: always(), and a new push of a pull request cancels the run before it"
|
|
1587
|
+
},
|
|
1588
|
+
{
|
|
1589
|
+
repo: "template",
|
|
1590
|
+
rule: "gate",
|
|
1591
|
+
doc: "pull request 189 (2026-11-05): the test of a cancel in the queue, a cancel in a job, a time limit, a failed need and a skipped need"
|
|
1592
|
+
}
|
|
1593
|
+
],
|
|
1594
|
+
options: {},
|
|
1595
|
+
check(context) {
|
|
1596
|
+
const files = context.gitFiles();
|
|
1597
|
+
if (files === void 0) return { skipped: "the root is not in a git repository" };
|
|
1598
|
+
const breaks = [];
|
|
1599
|
+
for (const file of files.filter((path) => WORKFLOW$1.test(path)).sort(byCode)) {
|
|
1600
|
+
let text;
|
|
1601
|
+
try {
|
|
1602
|
+
text = readFileSync(join(context.root, file), "utf8");
|
|
1603
|
+
} catch {
|
|
1604
|
+
continue;
|
|
1605
|
+
}
|
|
1606
|
+
const gates = alwaysGates(text);
|
|
1607
|
+
const after = withNotCancelled(text);
|
|
1608
|
+
for (const gate of gates) breaks.push({
|
|
1609
|
+
file,
|
|
1610
|
+
line: gate.line + 1,
|
|
1611
|
+
message: `A summary job of ${file} has \`always()\` in its condition. After a cancel it asks for a runner, and the new run waits behind it.`,
|
|
1612
|
+
...gate.only ? { edits: [{
|
|
1613
|
+
file,
|
|
1614
|
+
before: text,
|
|
1615
|
+
after
|
|
1616
|
+
}] } : { fix: `A person must change it, because the condition has other parts. ${gateAfterCancel.fix}` }
|
|
1617
|
+
});
|
|
1618
|
+
}
|
|
1619
|
+
return breaks;
|
|
1620
|
+
}
|
|
1621
|
+
};
|
|
1531
1622
|
// src/rules/main-runs-finish.ts
|
|
1532
1623
|
/**
|
|
1533
1624
|
* The rule `main-runs-finish`: a workflow that starts on `push` or on `workflow_call` does not cancel a run in progress.
|
|
@@ -1852,7 +1943,7 @@ function convertGate(text, file, commit = ACTIONS_COMMIT) {
|
|
|
1852
1943
|
"",
|
|
1853
1944
|
`${jobIndent}${summaryId}:`,
|
|
1854
1945
|
`${job}name: ${name}`,
|
|
1855
|
-
`${job}if:
|
|
1946
|
+
`${job}if: ${NOT_CANCELLED}`,
|
|
1856
1947
|
`${job}needs: [${["changes", ...ids].join(", ")}]`,
|
|
1857
1948
|
`${job}runs-on: ubuntu-latest`,
|
|
1858
1949
|
`${job}timeout-minutes: 2`,
|
|
@@ -12190,6 +12281,7 @@ const RULES = [
|
|
|
12190
12281
|
mainRunsFinish,
|
|
12191
12282
|
pushMainOnly,
|
|
12192
12283
|
pipeFails,
|
|
12284
|
+
gateAfterCancel,
|
|
12193
12285
|
gateTrigger,
|
|
12194
12286
|
homePackage,
|
|
12195
12287
|
licenseFile,
|
|
@@ -12627,6 +12719,6 @@ function runMap(args, io) {
|
|
|
12627
12719
|
else io.stdout(mapText(found));
|
|
12628
12720
|
return 0;
|
|
12629
12721
|
}
|
|
12630
|
-
export { pushMainOnly as $,
|
|
12722
|
+
export { pushMainOnly as $, globToRegExp as $t, roadmapOfLine as A, ACTIONS_COMMIT as At, SHIPPED_FIELDS as B, cleanPath as Bt, isSourcePath as C, MAP_RULE as Ct, blockHash as D, mergeHomes as Dt, HOME_TIMEOUT_MS as E, mapText as Et, minorOf as F, gateAfterCancel as Ft, pipeFails as G, lineOf as Gt, npmLookup as H, hasFile as Ht, publishedMinor as I, readWorkflow as It, pinnedGitDeps as J, readJsonc as Jt, isGitSpecifier as K, matchesAny as Kt, publishedMinorRule as L, STRICT_OPTIONS as Lt, requiredScripts as M, gateTrigger as Mt, releaseFiles as N, prPathFilters as Nt, githubFetch as O, readOverlay as Ot, lockedVersions as P, summaryName as Pt, scheduleMinute as Q, globFolders as Qt, reachOf as R, cuePreset as Rt, tsconfigTest as S, HOMES as St, sourceMain as T, mapMarkdown as Tt, unreleasedChange as U, inFolder as Ut, UNSHIPPED_FILES as V, codePackages as Vt, unreleasedChangeRule as W, keyLine as Wt, repositoryOfRemote as X, runGit as Xt, pagesAfterRelease as Y, replaceLine as Yt, runnerBudget as Z, specifiersOf as Zt, configsOfScript as _, declaredName as _t, listRules as a, HOME_PATTERNS as at, testsRequired as b, repoOf as bt, runCli as c, REAL_COMPARE as ct, RULES as d, LICENSE_TEXTS as dt, packageFolders as en, PAGES_WORKFLOWS as et, workspaceProtocol as f, authorOf as ft, typedScripts as g, repositoryIsPublic as gt, trustPolicy as h, mitText as ht, formatResult as i, DEFAULT_ALLOWED as it, roadmapParses as j, convertGate as jt, sharedDocsRule as k, HOME_EXPORTS as kt, runFix as l, hasImportMetaMain as lt, TRAIN_SCOPES as m, licenseFileOf as mt, annotations as n, defaultOptions as nn, pagesSite as nt, readConfig as o, noLocalPaths as ot, IGNORE_AFTER as p, licenseFile as pt, isPinned as q, parseJsonc as qt, createContext as r, parseConfig as rn, apiReportScript as rt, runChecks as s, noBuildOutput as st, USAGE as t, workspaceGlobs as tn, pagesCalls as tt, summaryMarkdown as u, mainCheck as ut, scriptsOf as v, homePackage as vt, pathsOf as w, findHomes as wt, hasTests as x, signaturesOf as xt, typedFiles as y, messageOf as yt, NPM_REGISTRY as z, DEPENDENCY_FIELDS as zt };
|
|
12631
12723
|
|
|
12632
|
-
//# sourceMappingURL=run-
|
|
12724
|
+
//# sourceMappingURL=run-D0rhX3d_.js.map
|