
* wip * add another * check * add ci job * fix ci * fix * maybe * maybs * attempt * test * maybe * another attempt * try v2 * align with normal build * this should break build * Revert "this should break build" This reverts commit 1ba44d18a1d8737aa6232db2d9b9081e892e6ca2. * tweaks * prevent breaking on main Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
37 lines
1 KiB
TypeScript
37 lines
1 KiB
TypeScript
/* eslint-disable @typescript-eslint/no-explicit-any */
|
||
import { execSync } from "child_process";
|
||
|
||
const diff = execSync(`git diff --name-only origin/main HEAD`).toString();
|
||
|
||
const files = diff.trim().split("\n");
|
||
|
||
console.log("ℹ️ Changed files:");
|
||
console.log(
|
||
files
|
||
.filter(Boolean)
|
||
.map((str) => ` - ${str}`)
|
||
.join("\n")
|
||
);
|
||
|
||
try {
|
||
console.log("⏳ Checking type errors..");
|
||
execSync("yarn tsc --noEmit", {});
|
||
|
||
console.log("😻 No errors!");
|
||
} catch (_err) {
|
||
const err = _err as any;
|
||
|
||
const output = err.stdout.toString() as string;
|
||
|
||
const filesWithTypeErrors = files.filter((file) => output.includes(file));
|
||
|
||
if (!filesWithTypeErrors.length) {
|
||
console.log(`🎉 You haven't introduced any new type errors!`);
|
||
process.exit(0);
|
||
}
|
||
console.log("❌ ❌ ❌ You seem to have touched files that have type errors ❌ ❌ ❌");
|
||
console.log("🙏 Please inspect the following files:");
|
||
console.log(filesWithTypeErrors.map((str) => ` - ${str}`).join("\n"));
|
||
|
||
process.exit(1);
|
||
}
|