Skip to content

Commit fbb8b97

Browse files
committed
Add initial TS implementation of update-required-checks.sh
1 parent b8eb533 commit fbb8b97

File tree

1 file changed

+46
-0
lines changed

1 file changed

+46
-0
lines changed

pr-checks/sync-checks.ts

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
#!/usr/bin/env npx tsx
2+
3+
/** Update the required checks based on the current branch. */
4+
5+
import { parseArgs } from "node:util";
6+
7+
import { OLDEST_SUPPORTED_MAJOR_VERSION } from "./config";
8+
9+
async function main(): Promise<void> {
10+
const { values: options } = parseArgs({
11+
options: {
12+
// The token to use to authenticate to the API.
13+
token: {
14+
type: "string",
15+
},
16+
// The git ref for which to retrieve the check runs.
17+
ref: {
18+
type: "string",
19+
},
20+
// By default, we perform a dry-run. Setting `apply` to `true` actually applies the changes.
21+
apply: {
22+
type: "boolean",
23+
default: false,
24+
},
25+
},
26+
strict: true,
27+
});
28+
29+
if (options.token === undefined) {
30+
throw new Error("Missing --token");
31+
}
32+
if (options.ref === undefined) {
33+
throw new Error("Missing --ref");
34+
}
35+
36+
console.info(
37+
`Oldest supported major version is: ${OLDEST_SUPPORTED_MAJOR_VERSION}`,
38+
);
39+
40+
process.exit(0);
41+
}
42+
43+
// Only call `main` if this script was run directly.
44+
if (require.main === module) {
45+
void main();
46+
}

0 commit comments

Comments
 (0)