workspace-conformance 1.1.0 → 1.2.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/dist/index.d.ts CHANGED
@@ -2,6 +2,71 @@ import { CompilerOptions } from "ts-morph";
2
2
  import { ConfigFileOptions, LayoutConfig, RankSkipOptions, Section } from "@exadev/config";
3
3
  import { z } from "zod";
4
4
  import { IViolation } from "dependency-cruiser";
5
+ //#region src/github.d.ts
6
+ /**
7
+ * A repository on GitHub.
8
+ */
9
+ interface RepositorySlug {
10
+ readonly owner: string;
11
+ readonly name: string;
12
+ }
13
+ /**
14
+ * The repository settings the settings checks read.
15
+ */
16
+ interface RepositorySettings {
17
+ readonly defaultBranch: string;
18
+ readonly allowRebaseMerge: boolean;
19
+ readonly allowSquashMerge: boolean;
20
+ readonly allowMergeCommit: boolean;
21
+ }
22
+ /**
23
+ * The rules that apply to a branch, whichever ruleset they come from, reduced to what the settings checks read.
24
+ */
25
+ interface BranchRules {
26
+ /**
27
+ * One entry per `required_status_checks` rule.
28
+ */
29
+ readonly requiredStatusChecks: readonly {
30
+ readonly contexts: readonly string[];
31
+ readonly strict: boolean;
32
+ }[];
33
+ /**
34
+ * One entry per `pull_request` rule. `allowedMergeMethods` is undefined when the rule does not restrict them.
35
+ */
36
+ readonly pullRequests: readonly {
37
+ readonly requiredReviewThreadResolution: boolean;
38
+ readonly allowedMergeMethods: readonly string[] | undefined;
39
+ }[];
40
+ }
41
+ /**
42
+ * What the settings checks need from GitHub, so a test or another host can supply it without a network. The real implementation is {@link createGitHubClient}. Both methods reject when the repository or branch cannot be read.
43
+ */
44
+ interface GitHubClient {
45
+ readonly repository: (slug: RepositorySlug) => Promise<RepositorySettings>;
46
+ readonly branchRules: (slug: RepositorySlug, branch: string) => Promise<BranchRules>;
47
+ }
48
+ /**
49
+ * Options of {@link createGitHubClient}.
50
+ */
51
+ interface GitHubClientOptions {
52
+ /**
53
+ * A token that can read the repository's settings and rulesets. The API reports the merge-method settings only to a token with write access to the repository, so a token without it makes {@link GitHubClient.repository} reject.
54
+ */
55
+ readonly token: string;
56
+ /**
57
+ * The API root. `https://api.github.com` when omitted.
58
+ */
59
+ readonly apiUrl?: string;
60
+ /**
61
+ * The `fetch` to use. The global one when omitted.
62
+ */
63
+ readonly fetch?: typeof fetch;
64
+ }
65
+ /**
66
+ * A {@link GitHubClient} over the REST API.
67
+ */
68
+ export declare function createGitHubClient(options: GitHubClientOptions): GitHubClient;
69
+ //#endregion
5
70
  //#region src/check.d.ts
6
71
  /**
7
72
  * A position in a file, both numbers counted from 1.
@@ -53,6 +118,16 @@ type CheckFunction<Options> = (context: CheckContext<Options>) => Promise<readon
53
118
  * A check that also needs the resolved workspace layout.
54
119
  */
55
120
  type LayoutCheckFunction<Options> = (context: LayoutCheckContext<Options>) => Promise<readonly Violation[]>;
121
+ /**
122
+ * What a check that reads repository settings through the GitHub API receives.
123
+ */
124
+ interface GitHubCheckContext<Options> extends CheckContext<Options> {
125
+ readonly github: GitHubClient;
126
+ }
127
+ /**
128
+ * A check that reads repository settings through the GitHub API. Its violations name the repository (`owner/name`) as the file.
129
+ */
130
+ type GitHubCheckFunction<Options> = (context: GitHubCheckContext<Options>) => Promise<readonly Violation[]>;
56
131
  //#endregion
57
132
  //#region src/migrations/adapters.d.ts
58
133
  /**
@@ -125,6 +200,156 @@ type DeployToolName = (typeof deployToolNames)[number];
125
200
  export declare const generators: Readonly<Record<GeneratorName, GeneratorAdapter>>;
126
201
  export declare const deployTools: Readonly<Record<DeployToolName, DeployToolAdapter>>;
127
202
  //#endregion
203
+ //#region src/workflows/model.d.ts
204
+ /**
205
+ * How much of a scope the `GITHUB_TOKEN` is granted.
206
+ */
207
+ type PermissionAccess = "read" | "write" | "none";
208
+ /**
209
+ * The `permissions` of a workflow or job as written. A scope missing from a `scopes` mapping is `none`, because GitHub sets every scope that is not specified to `none` as soon as any is specified. When nothing is declared the token gets the repository's default permissions, a setting the workflow file cannot show.
210
+ */
211
+ type Permissions = {
212
+ readonly kind: "default";
213
+ } | {
214
+ readonly kind: "all";
215
+ readonly access: "read" | "write";
216
+ } | {
217
+ readonly kind: "scopes";
218
+ readonly scopes: ReadonlyMap<string, PermissionAccess>;
219
+ };
220
+ /**
221
+ * The access `permissions` grants to `scope`, or `undefined` when the permissions are not declared and the repository default applies.
222
+ */
223
+ export declare function accessOf(permissions: Permissions, scope: string): PermissionAccess | undefined;
224
+ /**
225
+ * What a job's `runs-on` names: literal labels, labels that are expressions, and a runner group.
226
+ */
227
+ interface RunsOn {
228
+ readonly labels: readonly string[];
229
+ readonly expressions: readonly string[];
230
+ readonly group: string | undefined;
231
+ }
232
+ /**
233
+ * One step of a job. Every value is the text written in the file; expressions are not evaluated.
234
+ */
235
+ interface Step {
236
+ readonly index: number;
237
+ readonly id: string | undefined;
238
+ readonly name: string | undefined;
239
+ readonly uses: string | undefined;
240
+ readonly run: string | undefined;
241
+ readonly with: Readonly<Record<string, string>>;
242
+ readonly env: Readonly<Record<string, string>>;
243
+ readonly condition: string | undefined;
244
+ readonly location: SourceLocation;
245
+ }
246
+ /**
247
+ * One job. A job that calls a reusable workflow has `uses` and no steps.
248
+ */
249
+ interface Job {
250
+ readonly id: string;
251
+ readonly name: string | undefined;
252
+ /**
253
+ * The jobs named by `needs`, directly.
254
+ */
255
+ readonly needs: readonly string[];
256
+ readonly condition: string | undefined;
257
+ readonly permissions: Permissions;
258
+ readonly env: Readonly<Record<string, string>>;
259
+ readonly runsOn: RunsOn;
260
+ readonly timeoutMinutes: string | undefined;
261
+ readonly uses: string | undefined;
262
+ readonly with: Readonly<Record<string, string>>;
263
+ readonly outputs: Readonly<Record<string, string>>;
264
+ readonly steps: readonly Step[];
265
+ readonly location: SourceLocation;
266
+ }
267
+ /**
268
+ * A parsed workflow file.
269
+ */
270
+ interface Workflow {
271
+ /**
272
+ * The path relative to the directory the checks run in, with `/` separators.
273
+ */
274
+ readonly file: string;
275
+ readonly name: string | undefined;
276
+ /**
277
+ * The events in `on`, each with its configuration (`undefined` for an event written without any).
278
+ */
279
+ readonly triggers: ReadonlyMap<string, unknown>;
280
+ /**
281
+ * Where each event of `triggers` is written.
282
+ */
283
+ readonly triggerLocations: ReadonlyMap<string, SourceLocation>;
284
+ readonly permissions: Permissions;
285
+ readonly env: Readonly<Record<string, string>>;
286
+ readonly jobs: readonly Job[];
287
+ /**
288
+ * The `value` of each output a reusable workflow declares under `on.workflow_call.outputs`.
289
+ */
290
+ readonly callOutputs: Readonly<Record<string, string>>;
291
+ }
292
+ /**
293
+ * Parse the text of a workflow file into the model the checks read. It throws `ConformanceError` when the file is not YAML or is not shaped like a workflow, since a check cannot judge what it cannot read.
294
+ */
295
+ export declare function parseWorkflow(file: string, source: string): Workflow;
296
+ /**
297
+ * The permissions that apply to a job: its own when it declares any, else the workflow's. A job's declaration replaces the workflow's whole, it is not merged with it.
298
+ */
299
+ export declare function effectivePermissions(workflow: Workflow, job: Job): Permissions;
300
+ /**
301
+ * The environment a step runs with: the workflow's, the job's and the step's, the later winning.
302
+ */
303
+ export declare function effectiveEnv(workflow: Workflow, job: Job, step: Step | undefined): Readonly<Record<string, string>>;
304
+ /**
305
+ * Every job `jobId` waits for, directly or through other jobs, not including itself. A `needs` that names no job of the workflow is followed no further.
306
+ */
307
+ export declare function transitiveNeeds(workflow: Workflow, jobId: string): ReadonlySet<string>;
308
+ /**
309
+ * A `uses` value: a local action or workflow, a Docker image, or a repository reference.
310
+ */
311
+ type UsesReference = {
312
+ readonly kind: "local";
313
+ readonly path: string;
314
+ } | {
315
+ readonly kind: "docker";
316
+ readonly image: string;
317
+ readonly digest: string | undefined;
318
+ } | {
319
+ readonly kind: "remote";
320
+ readonly owner: string;
321
+ readonly repository: string;
322
+ readonly path: string;
323
+ readonly ref: string | undefined;
324
+ };
325
+ /**
326
+ * Split a `uses` value into its parts.
327
+ */
328
+ export declare function parseUses(uses: string): UsesReference;
329
+ //#endregion
330
+ //#region src/workflows/load.d.ts
331
+ /**
332
+ * Which workflow files a check reads.
333
+ */
334
+ interface WorkflowSelection {
335
+ /**
336
+ * Globs of the workflow files, relative to the directory the checks run in. `.github/workflows/*.yml` and `.github/workflows/*.yaml` when omitted.
337
+ */
338
+ readonly workflows?: readonly string[];
339
+ /**
340
+ * Globs of files that are left out.
341
+ */
342
+ readonly exclude?: readonly string[];
343
+ }
344
+ /**
345
+ * Where GitHub looks for workflows: only this directory, and only the files directly in it.
346
+ */
347
+ export declare const DEFAULT_WORKFLOWS: readonly string[];
348
+ /**
349
+ * Read and parse the selected workflow files, sorted by path.
350
+ */
351
+ export declare function loadWorkflows(cwd: string, selection: WorkflowSelection): Promise<readonly Workflow[]>;
352
+ //#endregion
128
353
  //#region src/options.d.ts
129
354
  /**
130
355
  * Options of the `aggregate-mappers` check: every aggregate type a contract exports has a mapper file in the place the template names.
@@ -282,6 +507,155 @@ interface MigrationsDirectoryOptions {
282
507
  */
283
508
  readonly packageJsons?: readonly string[];
284
509
  }
510
+ /**
511
+ * Options of the `workflow-job-ordering` check: the jobs that release, deploy and report a required check are ordered so a failure stops what follows. Jobs are named by id; a role whose jobs are absent from a workflow is not judged there.
512
+ */
513
+ interface WorkflowJobOrderingOptions extends WorkflowSelection {
514
+ /**
515
+ * Ids of release jobs, which must wait for every deploy job. `release` when omitted.
516
+ */
517
+ readonly releaseJobs?: readonly string[];
518
+ /**
519
+ * Ids of deploy jobs. `deploy` when omitted.
520
+ */
521
+ readonly deployJobs?: readonly string[];
522
+ /**
523
+ * Ids of jobs that deploy documentation, which must wait for every release job and check out the default branch afresh. `docs-deploy` when omitted.
524
+ */
525
+ readonly docsDeployJobs?: readonly string[];
526
+ /**
527
+ * Ids of junction jobs: the one job that reports a single required check for the whole workflow. `required-checks` when omitted.
528
+ */
529
+ readonly junctionJobs?: readonly string[];
530
+ /**
531
+ * Ids of jobs a junction job need not wait for, such as a release job that only runs after the junction's own checks or a job that runs on demand only.
532
+ */
533
+ readonly junctionExempt?: readonly string[];
534
+ /**
535
+ * The default branch a documentation job must check out when it names a branch literally. `main` when omitted. The `github.event.repository.default_branch` expression is always accepted.
536
+ */
537
+ readonly defaultBranch?: string;
538
+ }
539
+ /**
540
+ * Options of the `workflow-skippable-jobs` check: a path filter must not leave a required check pending or skip a job without a junction job to report for it.
541
+ */
542
+ interface WorkflowSkippableJobsOptions extends WorkflowSelection {
543
+ /**
544
+ * Ids of junction jobs. `required-checks` when omitted.
545
+ */
546
+ readonly junctionJobs?: readonly string[];
547
+ /**
548
+ * The actions whose outputs say which paths changed, as `owner/repository`. `dorny/paths-filter`, `tj-actions/changed-files` and `step-security/changed-files` when omitted.
549
+ */
550
+ readonly pathFilterActions?: readonly string[];
551
+ }
552
+ /**
553
+ * Options of the `workflow-runner-resolution` check: a self-hosted or custom runner label is resolved once and read, not repeated.
554
+ */
555
+ interface WorkflowRunnerResolutionOptions extends WorkflowSelection {
556
+ /**
557
+ * Regular expressions, as source text, for the labels GitHub hosts itself and that may be repeated freely. `ubuntu`, `windows` and `macos` images, `-latest`, versioned, `-arm`, `-intel`, `-xlarge`, `-large` and `-slim` forms, when omitted. Setting it replaces that default.
558
+ */
559
+ readonly hostedLabels?: readonly string[];
560
+ }
561
+ /**
562
+ * Options of the `workflow-version-single-source` check.
563
+ */
564
+ type WorkflowVersionSingleSourceOptions = WorkflowSelection;
565
+ /**
566
+ * Options of the `workflow-credentials` check.
567
+ */
568
+ type WorkflowCredentialsOptions = WorkflowSelection;
569
+ /**
570
+ * Options of the `workflow-repository-dispatch` check: what a handler of `repository_dispatch` may do.
571
+ */
572
+ interface WorkflowRepositoryDispatchOptions extends WorkflowSelection {
573
+ /**
574
+ * Branch names that count as the default branch when a push names one literally. `main` and `master` when omitted. The `github.event.repository.default_branch` expression always counts.
575
+ */
576
+ readonly defaultBranches?: readonly string[];
577
+ /**
578
+ * Set when the repository has a rule requiring status checks on the default branch, which is what makes `gh pr merge --auto` wait. The file cannot show it, so by default an auto merge in a handler is reported; the `settings-required-checks` check verifies the rule itself.
579
+ */
580
+ readonly assumeRequiredChecks?: boolean;
581
+ }
582
+ /**
583
+ * Options of the `workflow-update-bot-cooldown` check: the update bots wait before proposing a release.
584
+ */
585
+ interface WorkflowUpdateBotCooldownOptions {
586
+ /**
587
+ * The Dependabot config, relative to the directory the checks run in. `.github/dependabot.yml`, else `.github/dependabot.yaml`, when omitted.
588
+ */
589
+ readonly dependabot?: string;
590
+ /**
591
+ * The Renovate config. `renovate.json`, `.renovaterc.json`, `.renovaterc` and `.github/renovate.json`, the first that exists, when omitted.
592
+ */
593
+ readonly renovate?: string;
594
+ }
595
+ /**
596
+ * Options of the `workflow-merge-group` check.
597
+ */
598
+ type WorkflowMergeGroupOptions = WorkflowSelection;
599
+ /**
600
+ * How strictly a reference must be pinned: to a full commit SHA, or any ref (tag, branch or SHA).
601
+ */
602
+ type PinningLevel = "sha" | "ref";
603
+ /**
604
+ * Options of the `workflow-action-pinning` check: the pinning policy for what workflows `uses`.
605
+ */
606
+ interface WorkflowActionPinningOptions extends WorkflowSelection {
607
+ /**
608
+ * What an action or reusable workflow from outside `organisations` must be pinned to. `sha` when omitted.
609
+ */
610
+ readonly thirdParty?: PinningLevel;
611
+ /**
612
+ * What an action or reusable workflow owned by one of `organisations` must be pinned to. `ref` when omitted.
613
+ */
614
+ readonly sameOrganisation?: PinningLevel;
615
+ /**
616
+ * The owners (users or organisations) that count as the same organisation. None when omitted, so nothing is relaxed unless it is named.
617
+ */
618
+ readonly organisations?: readonly string[];
619
+ /**
620
+ * Repositories exempt from the policy, as `owner/repository` or `owner/*`.
621
+ */
622
+ readonly allow?: readonly string[];
623
+ }
624
+ /**
625
+ * What the settings checks need to find the repository.
626
+ */
627
+ interface SettingsOptions {
628
+ /**
629
+ * The repository as `owner/name`. The `origin` remote of the working directory when omitted.
630
+ */
631
+ readonly repository?: string;
632
+ /**
633
+ * The branch whose rules are read. The repository's default branch when omitted.
634
+ */
635
+ readonly branch?: string;
636
+ }
637
+ /**
638
+ * Options of the `settings-merge-methods` check.
639
+ */
640
+ interface SettingsMergeMethodsOptions extends SettingsOptions {
641
+ /**
642
+ * The only merge method the repository allows. `rebase` when omitted.
643
+ */
644
+ readonly allowed?: "rebase" | "squash" | "merge";
645
+ }
646
+ /**
647
+ * Options of the `settings-required-checks` check.
648
+ */
649
+ interface SettingsRequiredChecksOptions extends SettingsOptions, WorkflowSelection {
650
+ /**
651
+ * Ids of the junction jobs whose check names must be required. `required-checks` when omitted.
652
+ */
653
+ readonly junctionJobs?: readonly string[];
654
+ }
655
+ /**
656
+ * Options of the `settings-review-thread-resolution` check.
657
+ */
658
+ type SettingsReviewThreadResolutionOptions = SettingsOptions;
285
659
  /**
286
660
  * The options of every check, by check name.
287
661
  */
@@ -298,6 +672,18 @@ interface CheckOptionsByName {
298
672
  readonly "commit-types": CommitTypesOptions;
299
673
  readonly "dockerfile-package-manager": DockerfilePackageManagerOptions;
300
674
  readonly "migrations-directory": MigrationsDirectoryOptions;
675
+ readonly "workflow-job-ordering": WorkflowJobOrderingOptions;
676
+ readonly "workflow-skippable-jobs": WorkflowSkippableJobsOptions;
677
+ readonly "workflow-runner-resolution": WorkflowRunnerResolutionOptions;
678
+ readonly "workflow-version-single-source": WorkflowVersionSingleSourceOptions;
679
+ readonly "workflow-credentials": WorkflowCredentialsOptions;
680
+ readonly "workflow-repository-dispatch": WorkflowRepositoryDispatchOptions;
681
+ readonly "workflow-update-bot-cooldown": WorkflowUpdateBotCooldownOptions;
682
+ readonly "workflow-merge-group": WorkflowMergeGroupOptions;
683
+ readonly "workflow-action-pinning": WorkflowActionPinningOptions;
684
+ readonly "settings-merge-methods": SettingsMergeMethodsOptions;
685
+ readonly "settings-required-checks": SettingsRequiredChecksOptions;
686
+ readonly "settings-review-thread-resolution": SettingsReviewThreadResolutionOptions;
301
687
  }
302
688
  /**
303
689
  * The name of a check.
@@ -500,12 +886,116 @@ export declare const instructionSymlinks: CheckFunction<InstructionSymlinksOptio
500
886
  */
501
887
  export declare const migrationsDirectory: CheckFunction<MigrationsDirectoryOptions>;
502
888
  //#endregion
889
+ //#region src/checks/settings-merge-methods.d.ts
890
+ /**
891
+ * Only one merge method is available for a pull request into the branch, `rebase` unless the options say otherwise. A method is available when the repository allows it and no `pull_request` rule that applies to the branch leaves it out of its allowed methods.
892
+ *
893
+ * Limits: it reads the repository settings and the rules of rulesets that apply to the branch; classic branch protection and a merge queue's own merge method are not read, so a repository whose queue owns the strategy is judged by what it still allows for a direct merge.
894
+ */
895
+ export declare const settingsMergeMethods: GitHubCheckFunction<SettingsMergeMethodsOptions>;
896
+ //#endregion
897
+ //#region src/checks/settings-required-checks.d.ts
898
+ /**
899
+ * The branch requires the check of every junction job of the workflows, and requires branches to be up to date before merging (strict mode). The check name of a job is its `name`, else its id.
900
+ *
901
+ * The junction job is the one that reports for the whole workflow, so requiring it requires everything it needs, including jobs a path filter may skip. Codes: `no-required-checks` (no `required_status_checks` rule applies), `required-check-missing` (a junction job's check is not among the required ones), `not-strict` (no rule sets the strict policy) and `no-junction-job` (no workflow has a job with an id from `junctionJobs`).
902
+ *
903
+ * Limits: it reads the rules of rulesets that apply to the branch; classic branch protection is not read, so a repository that uses it is reported as having no required checks. A junction job in a reusable workflow, or a name that is an expression, is not resolved.
904
+ */
905
+ export declare const settingsRequiredChecks: GitHubCheckFunction<SettingsRequiredChecksOptions>;
906
+ //#endregion
907
+ //#region src/checks/settings-review-thread-resolution.d.ts
908
+ /**
909
+ * A pull request cannot merge while a review conversation is unresolved: a `pull_request` rule that applies to the branch sets `required_review_thread_resolution`.
910
+ *
911
+ * Limits: it reads the rules of rulesets; classic branch protection is not read.
912
+ */
913
+ export declare const settingsReviewThreadResolution: GitHubCheckFunction<SettingsReviewThreadResolutionOptions>;
914
+ //#endregion
503
915
  //#region src/checks/single-storybook.d.ts
504
916
  /**
505
917
  * At most one Storybook exists, in the permitted directory (the workspace root unless the options say otherwise), and none in a package such as a UI package. A Storybook is a `.storybook` directory.
506
918
  */
507
919
  export declare const singleStorybook: CheckFunction<SingleStorybookOptions>;
508
920
  //#endregion
921
+ //#region src/checks/workflow-action-pinning.d.ts
922
+ /**
923
+ * Every `uses` of a step or job follows the pinning policy. By default an action or reusable workflow from outside the organisations in the options must be pinned by full commit SHA (a Docker image by digest), and one owned by an organisation listed in `organisations` may use any ref; `thirdParty` and `sameOrganisation` set either to `sha` or `ref`, and `allow` exempts repositories. Local actions and workflows (`./...`) are not judged.
924
+ *
925
+ * The check encodes whichever policy the options state and is never silent about it: with nothing configured every remote reference must be a SHA. Limits: it checks the form of the ref, not that the SHA belongs to the repository or to a release; a SHA written with a trailing version comment is read as the SHA; composite actions are not read.
926
+ */
927
+ export declare const workflowActionPinning: CheckFunction<WorkflowActionPinningOptions>;
928
+ //#endregion
929
+ //#region src/checks/workflow-credentials.d.ts
930
+ /**
931
+ * Credentials are granted to the steps that need them, and a publish with no token cannot quietly use one.
932
+ *
933
+ * `workflow-credentials/attestation-permissions`: a step of `actions/attest`, `actions/attest-build-provenance` or `actions/attest-sbom` needs `id-token: write` and `attestations: write` in the job's effective permissions. Permissions a job declares replace the workflow's; permissions declared nowhere are the repository's default, which the file cannot show and which never includes `id-token`, so they are reported.
934
+ *
935
+ * `workflow-credentials/tokenless-publish-unprotected`: a job with `id-token: write` that publishes (`npm`, `pnpm` or `yarn npm publish`, with options such as `-r` or `--filter <package>` before `publish`, `semantic-release`, `changeset publish`, `lerna publish`, bare or run through `pnpm`, `pnpm exec`, `yarn` or `npx`) and passes no token must blank `NODE_AUTH_TOKEN` and `NPM_TOKEN` (set them to `''` at step, job or workflow level) or request provenance (`--provenance`, `NPM_CONFIG_PROVENANCE: true`, or `publishConfig.provenance: true` in the `package.json` of the working directory). The npm CLI replaces any configured token with the one from the OIDC exchange, but when the exchange fails it falls back to whatever token the environment holds, silently. Only blanking the variables prevents that fallback. Provenance does not: npm signs it with the CI's own OIDC identity (through Sigstore), separately from the registry token, so a fallback publish still goes ahead with the inherited token and carries an attestation of where it was built. Requesting provenance is accepted because it makes such a publish traceable, not because it makes it safe.
936
+ *
937
+ * Limits: `registry-url` is not reported, because it does not stop the exchange (see the README); a job that calls a reusable workflow is not read; a publish inside a script file or composite action is not seen; provenance set in a `package.json` other than the one in the working directory is not read; a job is tokenless only when no token variable is non-empty anywhere in the job, so a publish that uses a secret is left alone.
938
+ */
939
+ export declare const workflowCredentials: CheckFunction<WorkflowCredentialsOptions>;
940
+ //#endregion
941
+ //#region src/checks/workflow-job-ordering.d.ts
942
+ /**
943
+ * The jobs that release, deploy and report a required check are ordered so that a failure stops what follows: a release job needs the deploy job, a documentation deploy job needs the release job and checks out the default branch afresh, and one junction job with `if: always()` needs every other job and fails only on `failure` or `cancelled`.
944
+ *
945
+ * Jobs are recognised by id (see the options), and a role with no job in a workflow is not judged there. Ordering is judged through the transitive `needs` graph; the junction job must list every job directly, because `needs.*.result` only covers direct needs, except jobs that never run for a pull request or a merge group (an `if` on `github.ref` or `github.event_name` that mentions neither `pull_request` nor `merge_group`, where an `&&` needs one such operand and an `||` needs every operand to be), jobs that need such a job or the junction job itself, and the ids in `junctionExempt`. What the junction job decides on is read as text: it must read the results of its needs (`needs.*.result`, `needs.<job>.result` or `toJSON(needs)`) and name both `'failure'` and `'cancelled'`, or use the `re-actors/alls-green` action; a result read in a way the text does not show is reported as incomplete.
946
+ */
947
+ export declare const workflowJobOrdering: CheckFunction<WorkflowJobOrderingOptions>;
948
+ //#endregion
949
+ //#region src/checks/workflow-merge-group.d.ts
950
+ /**
951
+ * A workflow that checks pull requests also runs for the merge queue: GitHub starts no run of it for a queued pull request unless the workflow has a `merge_group` trigger, and a required check that never reports blocks the queue.
952
+ *
953
+ * A workflow is taken to produce required checks when it is triggered by `pull_request`; `pull_request_target` is left out, since it runs trusted code against untrusted input and is not a place for required checks. The file cannot show which checks are required, so a `pull_request` workflow whose checks are not required is reported too: narrow the check with `workflows` and `exclude`. A `merge_group` trigger on a workflow with no `pull_request` trigger is not judged. Limits: a `merge_group` trigger takes only `branches` filters (`paths` is a filter of `push`, `pull_request` and `pull_request_target`), so a workflow path-filtered for pull requests still runs in the queue once it has the trigger; the `branches` filter of a `merge_group` trigger is not read.
954
+ */
955
+ export declare const workflowMergeGroup: CheckFunction<WorkflowMergeGroupOptions>;
956
+ //#endregion
957
+ //#region src/checks/workflow-repository-dispatch.d.ts
958
+ /**
959
+ * A workflow that handles `repository_dispatch` can be started by anyone with write access through the API, so what it does with the repository is held to a higher bar.
960
+ *
961
+ * `workflow-repository-dispatch/pushes-default-branch`: a `git push` to the default branch, or one with no refspec while the default branch is checked out, or `git-auto-commit-action` on it. `auto-merge-without-required-checks`: `gh pr merge --auto`, which merges at once when the base branch requires no checks (the file cannot show the rule; `assumeRequiredChecks` states it, and `settings-required-checks` verifies it). `default-token-triggers-nothing`: a push (the checkout leaves `GITHUB_TOKEN` in git config unless it is given a `token`, and a push to a URL carrying its own credentials does not use it) or a pull request opened as `GITHUB_TOKEN`; events created with it start no workflows, apart from `workflow_dispatch` and `repository_dispatch`, so the pushed commit gets no checks. `dispatch-other-repository-with-default-token`: a dispatch to a repository other than `github.repository` with `GITHUB_TOKEN`, whose access is limited to its own repository. Dispatching in the same repository with `GITHUB_TOKEN` is allowed by GitHub and is not reported.
962
+ *
963
+ * Limits: commands are read as text, so a script file or composite action is not seen; a push is judged by its command line, so a branch created by a helper is not seen, and a quoted word that contains a space is not read as one word; a dispatch target written literally as this repository's own name is reported, since the file does not know the name; a job that calls a reusable workflow is not read.
964
+ */
965
+ export declare const workflowRepositoryDispatch: CheckFunction<WorkflowRepositoryDispatchOptions>;
966
+ //#endregion
967
+ //#region src/checks/workflow-runner-resolution.d.ts
968
+ /**
969
+ * A self-hosted or custom runner label named literally in more than one job of a workflow is resolved once instead: a resolver job decides the runner and the others read it with `fromJson(needs.<resolver>.outputs.<name>)`. The resolver must have a `timeout-minutes` and its output a literal fallback that names only hosted runner labels, so jobs still get a runner when resolution fails or the self-hosted fleet is down.
970
+ *
971
+ * A label is custom when it matches none of `hostedLabels`; the default patterns recognise GitHub's standard images, so a larger runner is named by a custom label and counts. Labels are compared within a workflow file, not across files. A resolver that is a reusable workflow is followed when it is a file of this repository (the output is traced through `on.workflow_call.outputs` to the job that sets it); a resolver in another repository cannot be read and is not judged. An output is taken to have a fallback when its expression has `||` followed by a string literal, and the last such literal is read as JSON (a label or a list of labels) and matched against `hostedLabels`; a fallback that is not valid JSON, or names any other label, is reported.
972
+ */
973
+ export declare const workflowRunnerResolution: CheckFunction<WorkflowRunnerResolutionOptions>;
974
+ //#endregion
975
+ //#region src/checks/workflow-skippable-jobs.d.ts
976
+ /**
977
+ * Keeping work off a pull request must not leave a required check without a result. A `paths` or `paths-ignore` filter on the trigger of a workflow with a junction job skips the whole workflow, so the required check stays pending forever; a job whose own `if` reads a path filter's outputs is skipped, which is only safe when a junction job with `if: always()` needs it and reports for it. Filter the steps of the job instead and the job still runs and reports.
978
+ *
979
+ * Limits: a workflow is taken to produce a required check when it has a junction job, so a trigger path filter in a workflow without one is not reported; a path filter is recognised by the actions in the options, so a script that computes changed paths itself is not seen, and a job gated on the output of such a script is not reported; only the filters of the `pull_request` and `pull_request_target` triggers are read, so a `paths` filter on `push` is not reported; only `needs.<job>.outputs` in the job's own `if` is read. Whether the junction job really reports is judged by `workflow-job-ordering`.
980
+ */
981
+ export declare const workflowSkippableJobs: CheckFunction<WorkflowSkippableJobsOptions>;
982
+ //#endregion
983
+ //#region src/checks/workflow-update-bot-cooldown.d.ts
984
+ /**
985
+ * The update bots wait before proposing a release, so a compromised release is withdrawn before it is installed. Dependabot: every `updates` entry needs a `cooldown` with `default-days` or one of the `semver-*-days` above zero. Renovate: `minimumReleaseAge` must be set to a duration above zero at the top level or in a `packageRules` entry.
986
+ *
987
+ * Limits: the bots' own rules differ, since Dependabot's cooldown does not apply to security updates, and a Renovate preset is not resolved (an `extends` entry counts only when its name contains `minimumReleaseAge`), so a setting that comes from a preset under another name is reported. Renovate configs in JSON5 syntax beyond comments and trailing commas, and a `renovate` key in `package.json`, are not read. A repository with neither bot has nothing to report.
988
+ */
989
+ export declare const workflowUpdateBotCooldown: CheckFunction<WorkflowUpdateBotCooldownOptions>;
990
+ //#endregion
991
+ //#region src/checks/workflow-version-single-source.d.ts
992
+ /**
993
+ * A setup step keeps a runtime version in the workflow when a version file already says it: `.nvmrc` for Node, `.tool-versions` for any tool it lists. The step reads the file instead (`node-version-file`, or `mise` or `asdf` actions), so there is one place to change.
994
+ *
995
+ * A version is a literal when it contains no expression, so `${{ matrix.node }}` is not reported: a matrix tests versions on purpose. A range or alias such as `lts/*` is a literal. Only the setup actions listed in the README are recognised, only the files in the working directory are looked for, and composite actions are not read.
996
+ */
997
+ export declare const workflowVersionSingleSource: CheckFunction<WorkflowVersionSingleSourceOptions>;
998
+ //#endregion
509
999
  //#region src/config.d.ts
510
1000
  /**
511
1001
  * The `checks` map of the `conformance` section: a check runs when its name is present with an options object (`{}` for the defaults), and `false` turns it off, which lets a config that extends another switch one of its checks off.
@@ -543,6 +1033,10 @@ interface RunInput {
543
1033
  readonly checks: ChecksConfig;
544
1034
  readonly layout: LayoutConfig | undefined;
545
1035
  readonly configFiles: ConfigFileOptions | undefined;
1036
+ /**
1037
+ * The client the settings checks read through; `undefined` when the run is offline.
1038
+ */
1039
+ readonly github: GitHubClient | undefined;
546
1040
  }
547
1041
  /**
548
1042
  * What every registered check has, whichever way it runs.
@@ -554,6 +1048,10 @@ interface RegisteredCheckBase<Name extends CheckName> {
554
1048
  * Whether the check reads the workspace layout, and so needs the `layout` section.
555
1049
  */
556
1050
  readonly requiresLayout: boolean;
1051
+ /**
1052
+ * Whether the check reads the repository's settings through the GitHub API, and so runs only when the run is given a client.
1053
+ */
1054
+ readonly requiresGitHub: boolean;
557
1055
  /**
558
1056
  * Whether the `checks` map turns this check on.
559
1057
  */
@@ -624,6 +1122,10 @@ interface RunChecksOptions {
624
1122
  * How config files are loaded: the sections loaded from `cwd` and the config files a check evaluates itself, such as the commitlint and release configs of `commit-types`. Only `alias` and `fsCache` apply to the latter.
625
1123
  */
626
1124
  readonly configFiles?: ConfigFileOptions;
1125
+ /**
1126
+ * The client the settings checks (`settings-*`) read the repository through. They run only when it is given, so a run without it stays offline and needs no token; naming one of them in `checks` without a client is an error.
1127
+ */
1128
+ readonly github?: GitHubClient;
627
1129
  }
628
1130
  /**
629
1131
  * The violations of one check.
@@ -720,4 +1222,4 @@ export declare function proveExhaustive(input: {
720
1222
  readonly compilerOptions?: CompilerOptions;
721
1223
  }): ExhaustivenessProof;
722
1224
  //#endregion
723
- export type { AggregateMappersOptions, CaseRemoval, CheckContext, CheckFunction, CheckName, CheckOptionsByName, CheckResult, ChecksConfig, CommandTypesOptions, CommitTypesOptions, ConformanceConfig, DeployDirectory, DeploySelector, DeployToolAdapter, DeployToolName, DiscoveredPackage, DockerfilePackageManagerOptions, ExhaustivenessProof, GeneratorAdapter, GeneratorName, ImportGraphOptions, InstructionSymlinksOptions, LayoutCheckContext, LayoutCheckFunction, MigrationsDirectoryOptions, RegisteredCheck, RunChecksOptions, RunResult, SingleStorybookOptions, SourceLocation, TypeErrorReport, Violation, WorkspacePackage };
1225
+ export type { AggregateMappersOptions, BranchRules, CaseRemoval, CheckContext, CheckFunction, CheckName, CheckOptionsByName, CheckResult, ChecksConfig, CommandTypesOptions, CommitTypesOptions, ConformanceConfig, DeployDirectory, DeploySelector, DeployToolAdapter, DeployToolName, DiscoveredPackage, DockerfilePackageManagerOptions, ExhaustivenessProof, GeneratorAdapter, GeneratorName, GitHubCheckContext, GitHubCheckFunction, GitHubClient, GitHubClientOptions, ImportGraphOptions, InstructionSymlinksOptions, Job, LayoutCheckContext, LayoutCheckFunction, MigrationsDirectoryOptions, PermissionAccess, Permissions, PinningLevel, RegisteredCheck, RepositorySettings, RepositorySlug, RunChecksOptions, RunResult, RunsOn, SettingsMergeMethodsOptions, SettingsOptions, SettingsRequiredChecksOptions, SettingsReviewThreadResolutionOptions, SingleStorybookOptions, SourceLocation, Step, TypeErrorReport, UsesReference, Violation, Workflow, WorkflowActionPinningOptions, WorkflowCredentialsOptions, WorkflowJobOrderingOptions, WorkflowMergeGroupOptions, WorkflowRepositoryDispatchOptions, WorkflowRunnerResolutionOptions, WorkflowSelection, WorkflowSkippableJobsOptions, WorkflowUpdateBotCooldownOptions, WorkflowVersionSingleSourceOptions, WorkspacePackage };