22 lines
797 B
JavaScript
22 lines
797 B
JavaScript
import fs from "node:fs";
|
|
|
|
import { describe, expect, it } from "vitest";
|
|
|
|
const REPORT_WORKFLOWS = [".gitea/workflows/coverage.yml", ".gitea/workflows/bundle-budget.yml"].filter((workflowPath) =>
|
|
fs.existsSync(workflowPath),
|
|
);
|
|
|
|
describe("Gitea report workflow concurrency", () => {
|
|
if (REPORT_WORKFLOWS.length === 0) {
|
|
it("allows the temporary report-workflow pause", () => {
|
|
expect(REPORT_WORKFLOWS).toEqual([]);
|
|
});
|
|
} else {
|
|
it.each(REPORT_WORKFLOWS)("cancels superseded PR runs in %s", (workflowPath) => {
|
|
const workflow = fs.readFileSync(workflowPath, "utf8");
|
|
|
|
expect(workflow).toMatch(/^concurrency:\n group: \$\{\{ github\.workflow \}\}-\$\{\{ github\.event\.pull_request\.number \|\| github\.ref \}\}\n cancel-in-progress: true$/m);
|
|
});
|
|
}
|
|
});
|