Skip to content

Commit bec8cea

Browse files
committed
Check that all jobs are in all-tests-passed needs
1 parent 9b2efb7 commit bec8cea

4 files changed

Lines changed: 33 additions & 0 deletions

File tree

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
import * as fs from "node:fs";
2+
import * as yaml from "js-yaml";
3+
4+
const workflow = yaml.load(
5+
fs.readFileSync("../workflows/test.yml", "utf8"),
6+
) as any;
7+
const jobs = Object.keys(workflow.jobs);
8+
const allTestsPassed = workflow.jobs["all-tests-passed"];
9+
const needs: string[] = allTestsPassed.needs || [];
10+
11+
const expectedNeeds = jobs.filter((j) => j !== "all-tests-passed");
12+
const missing = expectedNeeds.filter((j) => !needs.includes(j));
13+
14+
if (missing.length > 0) {
15+
console.error(
16+
`Missing jobs in all-tests-passed needs: ${missing.join(", ")}`,
17+
);
18+
process.exit(1);
19+
}
20+
console.log("All jobs in test.yml are in the needs section of all-tests-passed.");

.github/workflows/test.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,10 @@ jobs:
2424
npm install
2525
- run: |
2626
npm run all
27+
- name: Transpile scripts
28+
run: |
29+
tsc *.ts
30+
working-directory: .github/scripts
2731
- name: Make sure no changes from linters are detected
2832
run: |
2933
git diff --exit-code || (echo "::error::Please run 'npm run all' to fix the issues" && exit 1)

package-lock.json

Lines changed: 8 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@
3333
},
3434
"devDependencies": {
3535
"@biomejs/biome": "1.9.4",
36+
"@types/js-yaml": "^4.0.9",
3637
"@types/node": "^22.13.10",
3738
"@types/semver": "^7.5.8",
3839
"@vercel/ncc": "^0.38.3",

0 commit comments

Comments
 (0)