if you touch it you fix it (#967)
* 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 1ba44d18a1
.
* tweaks
* prevent breaking on main
Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
pull/965/head^2
parent
a32e002fd7
commit
a67813ee77
|
@ -44,3 +44,28 @@ jobs:
|
||||||
- run: yarn prisma migrate deploy
|
- run: yarn prisma migrate deploy
|
||||||
- run: yarn test
|
- run: yarn test
|
||||||
- run: yarn build
|
- run: yarn build
|
||||||
|
|
||||||
|
types:
|
||||||
|
name: Check types
|
||||||
|
|
||||||
|
strategy:
|
||||||
|
matrix:
|
||||||
|
node: ["14.x"]
|
||||||
|
os: [ubuntu-latest]
|
||||||
|
runs-on: ${{ matrix.os }}
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- name: Checkout repo
|
||||||
|
uses: actions/checkout@v2
|
||||||
|
with:
|
||||||
|
fetch-depth: 0
|
||||||
|
|
||||||
|
- name: Use Node ${{ matrix.node }}
|
||||||
|
uses: actions/setup-node@v1
|
||||||
|
with:
|
||||||
|
node-version: ${{ matrix.node }}
|
||||||
|
|
||||||
|
- name: Install deps
|
||||||
|
uses: bahmutov/npm-install@v1
|
||||||
|
|
||||||
|
- run: yarn check-changed-files
|
||||||
|
|
|
@ -22,7 +22,8 @@
|
||||||
"postinstall": "prisma generate",
|
"postinstall": "prisma generate",
|
||||||
"pre-commit": "lint-staged",
|
"pre-commit": "lint-staged",
|
||||||
"lint": "eslint . --ext .ts,.js,.tsx,.jsx",
|
"lint": "eslint . --ext .ts,.js,.tsx,.jsx",
|
||||||
"prepare": "husky install"
|
"prepare": "husky install",
|
||||||
|
"check-changed-files": "yarn ts-node scripts/ts-check-changed-files.ts"
|
||||||
},
|
},
|
||||||
"engines": {
|
"engines": {
|
||||||
"node": "14.x",
|
"node": "14.x",
|
||||||
|
|
|
@ -0,0 +1,37 @@
|
||||||
|
/* 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);
|
||||||
|
}
|
Loading…
Reference in New Issue