Skip to content

Commit 8d85e74

Browse files
committed
Add type to represent exclusions.yml and loading helper
1 parent da44c92 commit 8d85e74

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

pr-checks/sync-checks.ts

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,30 @@
22

33
/** Update the required checks based on the current branch. */
44

5+
import * as fs from "fs";
56
import { parseArgs } from "node:util";
67

78
import * as githubUtils from "@actions/github/lib/utils";
89
import { type Octokit } from "@octokit/core";
910
import { type PaginateInterface } from "@octokit/plugin-paginate-rest";
1011
import { type Api } from "@octokit/plugin-rest-endpoint-methods";
12+
import * as yaml from "yaml";
1113

1214
import { OLDEST_SUPPORTED_MAJOR_VERSION } from "./config";
1315

16+
/** Represents a configuration of which checks should not be set up as required checks. */
17+
interface Exclusions {
18+
/** A list of strings that, if contained in a check name, are excluded. */
19+
contains: string[];
20+
/** A list of check names that are excluded if their name is an exact match. */
21+
is: string[];
22+
}
23+
24+
/** Loads the configuration for which checks to exclude. */
25+
function loadExclusions(): Exclusions {
26+
return yaml.parse(fs.readFileSync("excluded.yml", "utf-8")) as Exclusions;
27+
}
28+
1429
/** The type of the Octokit client. */
1530
type ApiClient = Octokit & Api & { paginate: PaginateInterface };
1631

0 commit comments

Comments
 (0)