mirror of
https://github.com/astral-sh/ruff-action.git
synced 2026-05-15 14:00:13 +02:00
Check that all jobs are in all-tests-passed needs
This commit is contained in:
@@ -0,0 +1,20 @@
|
||||
import * as fs from "node:fs";
|
||||
import * as yaml from "js-yaml";
|
||||
|
||||
const workflow = yaml.load(
|
||||
fs.readFileSync("../workflows/test.yml", "utf8"),
|
||||
) as any;
|
||||
const jobs = Object.keys(workflow.jobs);
|
||||
const allTestsPassed = workflow.jobs["all-tests-passed"];
|
||||
const needs: string[] = allTestsPassed.needs || [];
|
||||
|
||||
const expectedNeeds = jobs.filter((j) => j !== "all-tests-passed");
|
||||
const missing = expectedNeeds.filter((j) => !needs.includes(j));
|
||||
|
||||
if (missing.length > 0) {
|
||||
console.error(
|
||||
`Missing jobs in all-tests-passed needs: ${missing.join(", ")}`,
|
||||
);
|
||||
process.exit(1);
|
||||
}
|
||||
console.log("All jobs in test.yml are in the needs section of all-tests-passed.");
|
||||
Reference in New Issue
Block a user