@avi2dg/checks 0.39.0 → 0.40.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/CHANGELOG.md CHANGED
@@ -2,6 +2,14 @@
2
2
 
3
3
  Every release of `@avi2dg/checks`, newest first, written by the release from its conventional commits.
4
4
 
5
+ ## 0.40.0
6
+
7
+ Released 2026-10-11.
8
+
9
+ ### Features
10
+
11
+ - **delivery:** fold title lint into the ci job and trim docs-only runs [#146](https://github.com/avi2d/checks/pull/146)
12
+
5
13
  ## 0.39.0
6
14
 
7
15
  Released 2026-10-11.
package/README.md CHANGED
@@ -117,7 +117,33 @@ To consume the kit from a repository:
117
117
  - run: bun run test
118
118
  ```
119
119
 
120
- Add a pull request title lint step in another workflow using `./node_modules/.bin/commitlint`.
120
+ Lint the pull request title in the same job with one step:
121
+
122
+ ```yaml
123
+ - id: title
124
+ name: lint the title
125
+ env:
126
+ PR_TITLE: ${{ github.event.pull_request.title }}
127
+ GH_TOKEN: ${{ github.token }}
128
+ run: bunx checks-commit-title
129
+ ```
130
+
131
+ A repository whose branch protection requires `commitlint` keeps that required status name while `commitlint.yml` goes away.
132
+ The same job reports the title step's outcome under that name on every run, which needs `statuses: write`:
133
+
134
+ ```yaml
135
+ - name: report the title as commitlint
136
+ if: always()
137
+ env:
138
+ GH_TOKEN: ${{ github.token }}
139
+ HEAD_SHA: ${{ github.event.pull_request.head.sha }}
140
+ OUTCOME: ${{ steps.title.outcome }}
141
+ run: |
142
+ state=failure
143
+ if [ "$OUTCOME" = success ]; then state=success; fi
144
+ gh api "repos/$GITHUB_REPOSITORY/statuses/${HEAD_SHA:-$GITHUB_SHA}" -f state="$state" -f context=commitlint -f target_url="$GITHUB_SERVER_URL/$GITHUB_REPOSITORY/actions/runs/$GITHUB_RUN_ID" --silent
145
+ ```
146
+
121
147
  A private repository sets `runs-on: ${{ vars.CI_RUNS_ON || 'ubuntu-latest' }}` on each job, as [checks-ci-wiring](docs/gates/checks-ci-wiring.md#runners) requires.
122
148
  `checks-effect-scope` writes the Effect paths of `oxlint.config.ts` and the kit's severities into `tsconfig.json`, as [The Effect rules](docs/configs/effect-rules.md#language-service) says.
123
149
  `bun run lint` then ends with `checks-lint: <count> gate(s) pass`.
@@ -166,9 +192,11 @@ These bins run on their own:
166
192
  - [`checks-release-tag`](docs/gates/checks-release-tag.md) tags a landed release commit with its version and dispatches the release workflow on the tag.
167
193
  - [`checks-vendor`](docs/gates/checks-vendor.md) pins each library its `prepare` arguments name to a shared read-only clone and links it under `repos/`.
168
194
  - [`checks-browser`](docs/gates/checks-browser.md) opens a product's built pages in Chrome and fails on the layout, keyboard, motion, accessibility, nesting and asset checks its `browser-checks.json` declares.
195
+ - [`checks-commit-title`](docs/gates/checks-commit-title.md) lints the pull request title in one step of the `ci` job.
196
+ - [`checks-docs-only`](docs/gates/checks-docs-only.md) tells whether a change touches only top-level Markdown and Markdown under `docs/`, so a docs-only change skips the full run.
169
197
 
170
198
  `checks-lint` has [its own page](docs/gates/checks-lint.md), which says which range it resolves.
171
- oxlint and commitlint run through their own tools, as the pages under Related topics say.
199
+ oxlint runs through its own tool, as the pages under Related topics say.
172
200
 
173
201
  ## Upgrade
174
202
 
@@ -14,20 +14,26 @@ It arrives with the kit, since `@commitlint/cli` and `@commitlint/config-convent
14
14
  ## Workflow
15
15
 
16
16
  The lint runs in CI on pull requests, because `jj` never fires a git hook.
17
- Each repository owns `.github/workflows/commitlint.yml` and runs the installed `commitlint` binary in a pull request step.
17
+ Each repository lints the title in one step of its `ci` job with `bunx checks-commit-title`.
18
18
  The workflow lints with the installed kit's `commitlint.config.js`, so every repository holds titles to the same rules.
19
+ The `ci` job reports the title step's outcome as a `commitlint` status on every run, so a required `commitlint` status stays while `commitlint.yml` goes away.
20
+ That post needs the workflow's `statuses: write` permission.
21
+ The title lint runs before the docs-only filter, so a change to top-level Markdown and `docs/` Markdown alone still lints its title.
19
22
 
20
23
  ## What it lints
21
24
 
22
25
  It lints the pull request title and nothing else.
23
26
  The title is the enforced subject because a squash merge uses it as the main commit subject, and per-commit messages are not linted.
24
- GitHub appends ` (#N)` to the squashed subject, so the workflow lints the title with that suffix attached, and the header length limit applies to the landed subject, not the bare title.
25
- The workflow moves git's comment character off `#`, so a title starting with `#` is linted like any other.
26
- The workflow also triggers on `workflow_dispatch`, since GitHub holds the `pull_request` runs of a release pull request the workflow token opens until a maintainer approves them, as [checks-release-pr](../gates/checks-release-pr.md) says.
27
- A dispatched run carries no pull request, so the workflow reads the title of the one open pull request its branch heads, and fails when there is none.
27
+ GitHub appends the pull request number to the squashed subject, so the bin lints the title with ` (#0000)` attached.
28
+ The header length limit applies to the landed subject, not the bare title.
29
+ The bin moves the git comment character off `#`, so a title starting with `#` is linted like any other.
30
+ The `ci` job also triggers on `workflow_dispatch`, as [checks-release-pr](../gates/checks-release-pr.md) says.
31
+ GitHub holds the `pull_request` runs of a release pull request the workflow token opens until a maintainer approves them.
32
+ A dispatched run carries no pull request, so the bin reads the title of the one open pull request its branch heads.
33
+ It fails when there is none.
28
34
  That lookup needs the workflow's `pull-requests: read` permission.
29
- It reports a dispatched run's result on the head commit as a `commitlint` status, since GitHub keeps a dispatched run's check off the pull request.
30
- The kit's own `.github/workflows/commitlint.yml` shows the step.
35
+ The `commitlint` status covers a dispatched run too, since GitHub keeps a dispatched run's check off the pull request.
36
+ The kit's own `.github/workflows/ci.yml` shows the step.
31
37
 
32
38
  It never sees a commit's author or committer fields, nor the `Co-authored-by` trailer GitHub writes from a foreign author when it squashes, so it cannot enforce who a commit belongs to.
33
39
  [checks-commit-identity](../gates/checks-commit-identity.md) is that enforcement.
@@ -8,7 +8,8 @@ audience: consumers
8
8
 
9
9
  ## What it checks
10
10
 
11
- The kit requires `./node_modules/.bin/commitlint` on every pull request.
11
+ The kit requires `bunx checks-commit-title` on every pull request.
12
+ A step that calls `bun src/delivery/commit-title.ts` or `./node_modules/.bin/commitlint` directly still satisfies the check.
12
13
  It requires `bun run lint`, `bun run build`, `bun run typecheck` and `bun run test` for each of those scripts that `package.json` defines.
13
14
  A `build` script also requires `git diff --exit-code`.
14
15
  The target branch is the pull request base in CI, else the branch `refs/remotes/origin/HEAD` names, else the default branch of the repository in GitHub's event, else `main`.
@@ -0,0 +1,57 @@
1
+ ---
2
+ kind: reference
3
+ audience: consumers
4
+ ---
5
+ # checks-commit-title
6
+
7
+ `checks-commit-title` lints the pull request title against the shared commitlint config in one step of the `ci` job.
8
+
9
+ ## What it checks
10
+
11
+ It lints the pull request title and nothing else.
12
+ The title comes from `PR_TITLE` when the event carries one.
13
+ A dispatched run carries no pull request, so the bin reads the title of the one open pull request its branch heads.
14
+ It fails when there is none.
15
+ A run with no title to lint passes and says so.
16
+ The bin lints the title with ` (#0000)` attached, since GitHub appends the pull request number to the squashed subject.
17
+ It moves the git comment character off `#`, so a title starting with `#` is linted like any other.
18
+
19
+ ## What it reads
20
+
21
+ It reads `PR_TITLE` and `GITHUB_EVENT_NAME` from the environment.
22
+ A dispatched run also reads `GITHUB_REPOSITORY`, `GITHUB_REPOSITORY_OWNER` and `GITHUB_REF_NAME`, and calls `gh api` with `GH_TOKEN` for the open pull request.
23
+ It lints with the installed kit's commitlint config through the installed commitlint cli, as [The commit message lint](../configs/commit-messages.md) says.
24
+
25
+ ## Arguments
26
+
27
+ The bin takes no arguments.
28
+
29
+ ## Exit codes
30
+
31
+ | Code | Result |
32
+ | --- | --- |
33
+ | 0 | The title lints clean, or there is no title to lint. |
34
+ | 1 | The title breaks the rules, or no one open pull request heads the branch. |
35
+ | 2 | The kit config or binary cannot be resolved, or a dispatched run misses its environment. |
36
+
37
+ ## Sample output
38
+
39
+ ```
40
+ ⧗ --- input ---
41
+ # feat(lint): add x (#0000)
42
+ ✖ subject may not be empty [subject-empty]
43
+ ✖ type may not be empty [type-empty]
44
+
45
+ ✖ found 2 problems, 0 warnings
46
+ ⓘ Get help: https://github.com/conventional-changelog/commitlint/#what-is-commitlint
47
+ ```
48
+
49
+ ## When it runs
50
+
51
+ The `ci` job runs it on `pull_request` and `workflow_dispatch`, as [checks-ci-wiring](checks-ci-wiring.md) requires.
52
+ The job then posts its outcome as a `commitlint` status, as [The commit message lint](../configs/commit-messages.md) says.
53
+
54
+ ## Related topics
55
+
56
+ - [The commit message lint](../configs/commit-messages.md)
57
+ - [checks-ci-wiring](checks-ci-wiring.md)
@@ -0,0 +1,50 @@
1
+ ---
2
+ kind: reference
3
+ audience: consumers
4
+ ---
5
+ # checks-docs-only
6
+
7
+ `checks-docs-only` tells whether a change touches only top-level Markdown and Markdown under `docs/`, so a docs-only change skips the full `ci` run.
8
+
9
+ ## What it checks
10
+
11
+ A change is docs-only when every file it touches is a `.md` file at the top level or under `docs/`, and it touches at least one file.
12
+ Markdown anywhere else, such as a test fixture under `tests/` or a template under `dist/`, keeps the full run.
13
+ A rename counts both sides.
14
+ An empty change and a change with no range keep the full run.
15
+
16
+ ## What it reads
17
+
18
+ It reads the base and head refs from its arguments.
19
+ It compares their merge base with the head through `git merge-base` and `git diff`.
20
+
21
+ ## Arguments
22
+
23
+ ```sh
24
+ checks-docs-only <base-ref> <head-ref>
25
+ ```
26
+
27
+ With no arguments, the bin reports `docs-only=false`.
28
+
29
+ ## Exit codes
30
+
31
+ | Code | Result |
32
+ | --- | --- |
33
+ | 0 | The bin classified the change, and the verdict is on stdout. |
34
+ | 2 | The range cannot be decoded. |
35
+
36
+ ## Sample output
37
+
38
+ ```
39
+ docs-only=true
40
+ ```
41
+
42
+ ## When it runs
43
+
44
+ The `ci` job has a filter step that appends the verdict to `GITHUB_OUTPUT`, and the typecheck and test steps skip when the verdict reads `true`.
45
+ The build, its `git diff --exit-code` and `bun run lint` still run, so `checks-docs` and the generated blocks hold on a docs-only change.
46
+ The job itself always runs and reports, so every required check stays green on a docs-only change.
47
+
48
+ ## Related topics
49
+
50
+ - [checks-ci-wiring](checks-ci-wiring.md)
@@ -47,7 +47,7 @@ The repository needs **Allow GitHub Actions to create and approve pull requests*
47
47
  checks-release-pr <workflow>...
48
48
  ```
49
49
 
50
- Each argument names a workflow file under `.github/workflows/` whose jobs report the checks the default branch requires, such as `ci.yml` and `commitlint.yml`.
50
+ Each argument names a workflow file under `.github/workflows/` whose jobs report the checks the default branch requires, such as `ci.yml`.
51
51
  Each named workflow triggers on `workflow_dispatch`.
52
52
  Name no workflow that runs something else on dispatch, such as a mutation baseline.
53
53
 
@@ -63,7 +63,7 @@ Name no workflow that runs something else on dispatch, such as a mutation baseli
63
63
  A run that opens the pull request prints the build's own output, then one line:
64
64
 
65
65
  ```
66
- release-pr: opened https://github.com/acme/widget/pull/12 to release 0.4.0, and dispatched ci.yml, commitlint.yml on release/main
66
+ release-pr: opened https://github.com/acme/widget/pull/12 to release 0.4.0, and dispatched ci.yml on release/main
67
67
  ```
68
68
 
69
69
  A run on the same `HEAD` the next day prints one line:
@@ -115,7 +115,7 @@ jobs:
115
115
  - name: open or refresh the release pull request
116
116
  env:
117
117
  GH_TOKEN: ${{ github.token }}
118
- run: ./node_modules/.bin/checks-release-pr ci.yml commitlint.yml
118
+ run: ./node_modules/.bin/checks-release-pr ci.yml
119
119
  tag:
120
120
  if: "github.event_name == 'push' && startsWith(github.event.head_commit.message, 'chore: release ')"
121
121
  runs-on: ubuntu-latest
@@ -150,8 +150,7 @@ Nothing requires them, and approving them runs the same checks again.
150
150
 
151
151
  The daily release needs the repository's other workflows to accept the dispatch:
152
152
 
153
- - `.github/workflows/ci.yml` and `.github/workflows/commitlint.yml` trigger on `workflow_dispatch`, grant `statuses: write`, and end each required job with the step below.
154
- `commitlint.yml` also grants `pull-requests: read`, which the title lookup needs.
153
+ - `.github/workflows/ci.yml` triggers on `workflow_dispatch`, grants `statuses: write` and `pull-requests: read`, and ends each required job with the step below.
155
154
  - The title lint reads the title of the one open pull request its branch heads when the event carries none, as [Commit messages](../configs/commit-messages.md) says.
156
155
  - `.github/workflows/release.yml` triggers on `workflow_dispatch` and refuses a ref that is not a tag, as [checks-release-notes](checks-release-notes.md) shows.
157
156
  - **Allow GitHub Actions to create and approve pull requests** is on, which the call after the step sets.
@@ -8,7 +8,7 @@ audience: consumers
8
8
 
9
9
  ## What it checks
10
10
 
11
- It reads the subject of `HEAD`, and does nothing unless the subject is `chore: release <version>`, with or without the ` (#N)` a squash merge adds.
11
+ It reads the subject of `HEAD`, and does nothing unless the subject is `chore: release <version>`, with or without the pull request number a squash merge appends.
12
12
  It refuses a release commit whose `package.json` holds another version.
13
13
  It tags `HEAD` as `v<version>` and pushes the tag to `origin`.
14
14
  A tag the workflow token pushes starts no `push` workflow, so it then dispatches the workflow its argument names on the tag.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@avi2dg/checks",
3
- "version": "0.39.0",
3
+ "version": "0.40.0",
4
4
  "description": "Deterministic checks shared across a set of TypeScript repositories",
5
5
  "license": "MIT",
6
6
  "repository": {
@@ -40,6 +40,8 @@
40
40
  "src/testing/test-report.ts",
41
41
  "src/testing/flake.ts",
42
42
  "src/delivery/commit-identity.ts",
43
+ "src/delivery/commit-title.ts",
44
+ "src/delivery/docs-only.ts",
43
45
  "src/testing/mutation.ts",
44
46
  "src/testing/mutation-scope.js",
45
47
  "src/testing/mutation-guard-plugin.js",
@@ -132,6 +134,8 @@
132
134
  "checks-test": "src/testing/test.ts",
133
135
  "checks-flake": "src/testing/flake.ts",
134
136
  "checks-commit-identity": "src/delivery/commit-identity.ts",
137
+ "checks-commit-title": "src/delivery/commit-title.ts",
138
+ "checks-docs-only": "src/delivery/docs-only.ts",
135
139
  "checks-mutation": "src/testing/mutation.ts",
136
140
  "checks-mutation-compare": "src/testing/mutation-compare.ts",
137
141
  "checks-mutation-baseline": "src/testing/mutation-baseline.ts",
@@ -11,6 +11,7 @@ export type { Command };
11
11
  export type Gate = {
12
12
  readonly command: string;
13
13
  readonly words: Command;
14
+ readonly alternatives: readonly Command[];
14
15
  };
15
16
 
16
17
  export type Declaration = {
@@ -63,7 +64,10 @@ export class WiringError extends Schema.TaggedError<WiringError>()("WiringError"
63
64
  const WORKFLOWS = ".github/workflows";
64
65
  const SCRIPTED = ["lint", "build", "typecheck", "test"];
65
66
  const BUILT_TREE = "git diff --exit-code";
66
- const TITLE_LINT = "./node_modules/.bin/commitlint";
67
+ const TITLE_LINT = "bunx checks-commit-title";
68
+ // The gate holds until every consumer migrates, so the direct commitlint call still counts.
69
+ // The kit calls its own file through bun, since bunx never resolves the working tree.
70
+ const TITLE_CALLS = ["bun src/delivery/commit-title.ts", "./node_modules/.bin/commitlint"];
67
71
  const Manifest = Schema.Struct({ scripts: Schema.optionalKey(Schema.Record(Schema.String, Schema.String)) });
68
72
  // Without these a pull_request workflow never sees the commits a pull request pushes.
69
73
  const GATING_TYPES = ["opened", "synchronize"];
@@ -207,6 +211,7 @@ function gapsAmong(gates: readonly Gate[], steps: readonly RunStep[], lintGates:
207
211
  const entryPoint = entryPointCommand(gate.words, lintGates);
208
212
  const commands = [
209
213
  { command: gate.command, words: gate.words },
214
+ ...gate.alternatives.map((words) => ({ command: gate.command, words })),
210
215
  ...(entryPoint === undefined ? [] : [{ command: entryPoint.join(" "), words: entryPoint }]),
211
216
  ];
212
217
  const invoking = steps.flatMap(({ location, blocker, script }) => {
@@ -258,7 +263,11 @@ export function requiredCommands(scripts: readonly string[]): readonly string[]
258
263
 
259
264
  export function declarationFor(scripts: readonly string[], branch: string): Declaration {
260
265
  return {
261
- gates: requiredCommands(scripts).map((command) => ({ command, words: command.split(" ") })),
266
+ gates: requiredCommands(scripts).map((command) => ({
267
+ command,
268
+ words: command.split(" "),
269
+ alternatives: command === TITLE_LINT ? TITLE_CALLS.map((call) => call.split(" ")) : [],
270
+ })),
262
271
  defaultBranch: branch,
263
272
  lintGates: KIT_GATES,
264
273
  };
@@ -0,0 +1,82 @@
1
+ #!/usr/bin/env bun
2
+ import { Config, Console, Effect, FileSystem, Path, Schema } from "effect";
3
+ import { collect } from "../core/git.ts";
4
+ import { runMain } from "../core/main.ts";
5
+
6
+ const NAME = "commit-title";
7
+
8
+ class TitleSetup extends Schema.TaggedError<TitleSetup>()("TitleSetup", {
9
+ message: Schema.String,
10
+ }) {}
11
+
12
+ const setup = (message: string): TitleSetup => new TitleSetup({ message });
13
+
14
+ // The cli entry stays inside its own package, so this resolves from the install cache as well as node_modules.
15
+ const cliOf = Effect.fn("cliOf")(function* () {
16
+ const entry = yield* Effect.try({
17
+ try: () => new URL("./cli.js", import.meta.resolve("@commitlint/cli")),
18
+ catch: () => setup("cannot resolve @commitlint/cli from the installed kit"),
19
+ });
20
+ return yield* (yield* Path.Path).fromFileUrl(entry);
21
+ });
22
+
23
+ // The config ships with the kit, so it sits two levels above this file wherever the kit is installed.
24
+ const configOf = Effect.fn("configOf")(function* () {
25
+ const file = yield* Effect.try({
26
+ try: () => new URL("../../commitlint.config.js", import.meta.url),
27
+ catch: () => setup("cannot resolve commitlint.config.js from the installed kit"),
28
+ });
29
+ return yield* (yield* Path.Path).fromFileUrl(file);
30
+ });
31
+
32
+ const dispatchedTitle = Effect.fn("dispatchedTitle")(function* () {
33
+ const repository = yield* Config.String("GITHUB_REPOSITORY").pipe(Config.withDefault(""));
34
+ const owner = yield* Config.String("GITHUB_REPOSITORY_OWNER").pipe(Config.withDefault(""));
35
+ const ref = yield* Config.String("GITHUB_REF_NAME").pipe(Config.withDefault(""));
36
+ if (repository === "" || owner === "" || ref === "") {
37
+ return yield* setup("a dispatched run lints the open pull request its branch heads, so it needs GITHUB_REPOSITORY, GITHUB_REPOSITORY_OWNER and GITHUB_REF_NAME");
38
+ }
39
+ // A dispatched run carries no pull request, so the title comes from the one open pull request the branch heads.
40
+ const found = yield* collect("gh", [
41
+ "api",
42
+ `repos/${repository}/pulls?head=${owner}:${ref}&state=open`,
43
+ "--jq",
44
+ `if length == 1 then .[0].title else error("no one open pull request heads the branch") end`,
45
+ ]);
46
+ const title = found.stdout.trim();
47
+ if (found.exitCode !== 0 || title === "" || title === "null") {
48
+ const report = found.stderr.trim() === "" ? found.stdout.trim() : found.stderr.trim();
49
+ if (report !== "") yield* Console.error(report);
50
+ return undefined;
51
+ }
52
+ return title;
53
+ });
54
+
55
+ const lintTitle = Effect.fn("lintTitle")(function* (title: string) {
56
+ const system = yield* FileSystem.FileSystem;
57
+ const path = yield* Path.Path;
58
+ const file = path.join(yield* system.makeTempDirectoryScoped({ prefix: "checks-commit-title-" }), "pr-title");
59
+ yield* system.writeFileString(file, `${title} (#0000)`);
60
+ // A title opening with the git comment character lints as empty without this: commentChar moves off the hash.
61
+ const linted = yield* collect(process.execPath, [yield* cliOf(), "--config", yield* configOf(), "--edit", file], undefined, {
62
+ env: { GIT_CONFIG_COUNT: "1", GIT_CONFIG_KEY_0: "core.commentChar", GIT_CONFIG_VALUE_0: "\x01" },
63
+ });
64
+ if (linted.stdout.trim() !== "") yield* Console.log(linted.stdout.trim());
65
+ if (linted.stderr.trim() !== "") yield* Console.error(linted.stderr.trim());
66
+ return linted.exitCode === 0;
67
+ });
68
+
69
+ const check = Effect.scoped(Effect.gen(function* () {
70
+ const direct = yield* Config.String("PR_TITLE").pipe(Config.withDefault(""));
71
+ if (direct !== "") return yield* lintTitle(direct);
72
+ const event = yield* Config.String("GITHUB_EVENT_NAME").pipe(Config.withDefault(""));
73
+ if (event === "workflow_dispatch") {
74
+ const title = yield* dispatchedTitle();
75
+ if (title === undefined) return false;
76
+ return yield* lintTitle(title);
77
+ }
78
+ yield* Console.log(`${NAME}: no pull request title is available, so there is nothing to lint`);
79
+ return true;
80
+ }));
81
+
82
+ if (import.meta.main) runMain(NAME, check);
@@ -0,0 +1,38 @@
1
+ #!/usr/bin/env bun
2
+ import { Console, Effect } from "effect";
3
+ import { changedPaths, git } from "../core/git.ts";
4
+ import { runMain } from "../core/main.ts";
5
+
6
+ const NAME = "docs-only";
7
+
8
+ export function isDocsPath(path: string): boolean {
9
+ const lower = path.toLowerCase();
10
+ return lower.endsWith(".md") && (!lower.includes("/") || lower.startsWith("docs/"));
11
+ }
12
+
13
+ // The verdict goes to stdout as one line, so a step appends it to GITHUB_OUTPUT; the detail goes to stderr.
14
+ const check = Effect.gen(function* () {
15
+ const [base, head] = process.argv.slice(2);
16
+ if (base === undefined || head === undefined) {
17
+ yield* Console.error(`${NAME}: no range is given, so the full run stays`);
18
+ yield* Console.log("docs-only=false");
19
+ return true;
20
+ }
21
+ const mergeBase = (yield* git(["merge-base", base, head])).trim();
22
+ const changes = yield* changedPaths(mergeBase, head, []);
23
+ const paths = changes.flatMap((change) => (change.kind === "renamed" ? [change.from, change.path] : [change.path]));
24
+ const full = paths.filter((path) => !isDocsPath(path));
25
+ if (paths.length === 0) {
26
+ yield* Console.error(`${NAME}: the range changes no file, so the full run stays`);
27
+ yield* Console.log("docs-only=false");
28
+ } else if (full.length === 0) {
29
+ yield* Console.error(`${NAME}: ${paths.length} changed file(s) are all top-level or docs/ Markdown, so the full run can skip`);
30
+ yield* Console.log("docs-only=true");
31
+ } else {
32
+ yield* Console.error(`${NAME}: ${full.length} changed file(s) need the full run`);
33
+ yield* Console.log("docs-only=false");
34
+ }
35
+ return true;
36
+ });
37
+
38
+ if (import.meta.main) runMain(NAME, check);