Files
hyperframes/scripts/merge-queue-workflows.test.mjs
T
Miguel Ángel fbaa9f9205 ci: stop running CodeQL on merge queue groups, where its upload races the merge (#4492)
* ci: stop running CodeQL on merge queue groups, where its upload races the merge

The code scanning rule does not apply to merge queue groups, and the queue deletes
a group ref when it merges, so the upload failed on about half the groups.
Pull requests and pushes to main keep scanning.

* ci: catch merge_group in any trigger form and say the upload race is intermittent
2026-09-25 16:50:55 +00:00

26 lines
957 B
JavaScript

import assert from "node:assert/strict";
import { readdirSync, readFileSync } from "node:fs";
import { join } from "node:path";
import test from "node:test";
import { parse } from "yaml";
const workflowsDir = join(import.meta.dirname, "..", ".github", "workflows");
const events = (on) =>
typeof on === "string" ? [on] : Array.isArray(on) ? on : Object.keys(on ?? {});
// The queue waits only for required checks and deletes a group's ref when it merges,
// so any other workflow on merge_group races that deletion and fails at random.
test("only the workflows that report required checks run on merge queue groups", () => {
const queued = readdirSync(workflowsDir).filter(
(file) =>
/\.ya?ml$/.test(file) &&
events(parse(readFileSync(join(workflowsDir, file), "utf8")).on).includes("merge_group"),
);
assert.deepEqual(queued.sort(), [
"ci.yml",
"pr-captures.yml",
"regression.yml",
"windows-render.yml",
]);
});