Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
PR checks: Add support for per-OS CodeQL version
  • Loading branch information
henrymercer committed Mar 11, 2026
commit 2bc06587aa5aeb8171e05d6ead4e35b37413104f
9 changes: 9 additions & 0 deletions pr-checks/sync.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,8 @@ interface Specification extends JobSpecification {
versions?: string[];
/** Operating system prefixes used to select runner images (e.g. `["ubuntu", "macos"]`). */
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. */
useAllPlatformBundle?: string;
/** Values for the `analysis-kinds` matrix dimension. */
Expand Down Expand Up @@ -317,6 +319,13 @@ function generateJobMatrix(
const operatingSystems = checkSpecification.operatingSystems ?? ["ubuntu"];

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;
}
Comment on lines +322 to +327

Copilot AI Mar 11, 2026

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

osCodeQlVersions is assumed to be a string[], but if a template accidentally provides a scalar (e.g. macos: linked) or other non-array value, this code will still run (because strings have .includes) and can silently produce an incomplete/incorrect matrix. Consider validating allowedVersions with Array.isArray(...) (and throwing a clear error if not), and optionally validating that the osCodeQlVersions keys match entries in operatingSystems to catch typos early.

Copilot uses AI. Check for mistakes.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Might be worth adding a JSON schema for the PR checks to validate this, rather than needing to validate each property individually. I think this is best left to a future PR.


const runnerImagesForOs = runnerImages.filter((image) =>
image.startsWith(operatingSystem),
);
Expand Down