PR checks: Add support for per-OS CodeQL version

This commit is contained in:
Henry Mercer
2026-03-11 17:10:45 +00:00
parent 1a97b0f94e
commit 2bc06587aa
+9
View File
@@ -38,6 +38,8 @@ interface Specification extends JobSpecification {
versions?: string[]; versions?: string[];
/** Operating system prefixes used to select runner images (e.g. `["ubuntu", "macos"]`). */ /** Operating system prefixes used to select runner images (e.g. `["ubuntu", "macos"]`). */
operatingSystems?: string[]; operatingSystems?: string[];
/** Per-OS version overrides. If specified for an OS, only those versions are tested on that OS. */
osCodeQlVersions?: Record<string, string[]>;
/** Whether to use the all-platform CodeQL bundle. */ /** Whether to use the all-platform CodeQL bundle. */
useAllPlatformBundle?: string; useAllPlatformBundle?: string;
/** Values for the `analysis-kinds` matrix dimension. */ /** Values for the `analysis-kinds` matrix dimension. */
@@ -317,6 +319,13 @@ function generateJobMatrix(
const operatingSystems = checkSpecification.operatingSystems ?? ["ubuntu"]; const operatingSystems = checkSpecification.operatingSystems ?? ["ubuntu"];
for (const operatingSystem of operatingSystems) { for (const operatingSystem of operatingSystems) {
// If osCodeQlVersions is set for this OS, only include the specified CodeQL versions.
const allowedVersions =
checkSpecification.osCodeQlVersions?.[operatingSystem];
if (allowedVersions && !allowedVersions.includes(version)) {
continue;
}
const runnerImagesForOs = runnerImages.filter((image) => const runnerImagesForOs = runnerImages.filter((image) =>
image.startsWith(operatingSystem), image.startsWith(operatingSystem),
); );