mirror of
https://github.com/github/codeql-action
synced 2026-05-23 20:00:54 +03:00
PR checks: Add support for per-OS CodeQL version
This commit is contained in:
@@ -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),
|
||||||
);
|
);
|
||||||
|
|||||||
Reference in New Issue
Block a user