MCPcopy Create free account
hub / github.com/remix-run/react-router / runChecks

Function runChecks

scripts/pr.ts:108–138  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

106// ---------- Checks ----------
107
108async function runChecks() {
109 let prNumber = parseInt(requireEnv("PR_NUMBER"), 10);
110 if (isNaN(prNumber)) {
111 console.error("PR_NUMBER must be numeric");
112 process.exit(1);
113 }
114
115 let checks: Check[] = [changeFileCheck, featurePrCheck];
116
117 let ctx: CheckContext = {
118 prNumber,
119 baseBranch: requireEnv("PR_BASE"),
120 eventAction: requireEnv("EVENT_ACTION"),
121 labelName: process.env.LABEL_NAME ?? "",
122 };
123 console.log("ctx:", ctx);
124
125 let result: { prNumber: number; actions: Action[] } = {
126 prNumber,
127 actions: [],
128 };
129
130 for (let check of checks) {
131 result.actions.push(...(await check(ctx)));
132 }
133
134 // Matches pr-checks.yml/pr-actions.yml workflow artifact name
135 let filename = "pr-checks-result.json";
136 console.log(`Writing ${filename}:`, JSON.stringify(result));
137 fs.writeFileSync(filename, JSON.stringify(result));
138}
139
140async function changeFileCheck(ctx: CheckContext): Promise<Action[]> {
141 if (ctx.baseBranch !== "main") return [];

Callers 1

pr.tsFile · 0.85

Calls 5

requireEnvFunction · 0.85
errorMethod · 0.80
logMethod · 0.80
pushMethod · 0.65
exitMethod · 0.45

Tested by

no test coverage detected