mirror of
https://github.com/github/codeql-action.git
synced 2026-10-03 17:41:28 +00:00
Add initial TS implementation of update-required-checks.sh
This commit is contained in:
46
pr-checks/sync-checks.ts
Executable file
46
pr-checks/sync-checks.ts
Executable file
@@ -0,0 +1,46 @@
|
||||
#!/usr/bin/env npx tsx
|
||||
|
||||
/** Update the required checks based on the current branch. */
|
||||
|
||||
import { parseArgs } from "node:util";
|
||||
|
||||
import { OLDEST_SUPPORTED_MAJOR_VERSION } from "./config";
|
||||
|
||||
async function main(): Promise<void> {
|
||||
const { values: options } = parseArgs({
|
||||
options: {
|
||||
// The token to use to authenticate to the API.
|
||||
token: {
|
||||
type: "string",
|
||||
},
|
||||
// The git ref for which to retrieve the check runs.
|
||||
ref: {
|
||||
type: "string",
|
||||
},
|
||||
// By default, we perform a dry-run. Setting `apply` to `true` actually applies the changes.
|
||||
apply: {
|
||||
type: "boolean",
|
||||
default: false,
|
||||
},
|
||||
},
|
||||
strict: true,
|
||||
});
|
||||
|
||||
if (options.token === undefined) {
|
||||
throw new Error("Missing --token");
|
||||
}
|
||||
if (options.ref === undefined) {
|
||||
throw new Error("Missing --ref");
|
||||
}
|
||||
|
||||
console.info(
|
||||
`Oldest supported major version is: ${OLDEST_SUPPORTED_MAJOR_VERSION}`,
|
||||
);
|
||||
|
||||
process.exit(0);
|
||||
}
|
||||
|
||||
// Only call `main` if this script was run directly.
|
||||
if (require.main === module) {
|
||||
void main();
|
||||
}
|
||||
Reference in New Issue
Block a user