From 2d85855366ad654e675845d39b1c2be6d1be0ccd Mon Sep 17 00:00:00 2001 From: "Michael B. Gale" Date: Wed, 28 Oct 2026 15:59:59 +0000 Subject: [PATCH] Refactor `defaultRunnerImages` into `DEFAULT_RUNNER_IMAGES` map --- pr-checks/sync.ts | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/pr-checks/sync.ts b/pr-checks/sync.ts index c205e94a7..02125504a 100755 --- a/pr-checks/sync.ts +++ b/pr-checks/sync.ts @@ -43,6 +43,13 @@ type WorkflowInputs = Partial>; /** An operating system identifier. */ type OperatingSystemIdentifier = "ubuntu" | "macos" | "windows"; +/** Mapping from {@link OperatingSystemIdentifier} to default runner image labels. */ +const DEFAULT_RUNNER_IMAGES: Record = { + ubuntu: "ubuntu-latest", + macos: "macos-latest", + windows: "windows-latest", +}; + /** * Represents an operating system matrix entry for a generated PR check workflow. * @@ -414,12 +421,6 @@ function generateJobMatrix( ); } - const defaultRunnerImages = [ - "ubuntu-latest", - "macos-latest", - "windows-latest", - ]; - for (const operatingSystemConfig of operatingSystems) { const operatingSystem = typeof operatingSystemConfig === "string" @@ -449,7 +450,7 @@ function generateJobMatrix( const runnerImagesForOs = typeof operatingSystemConfig === "string" || operatingSystemConfig["runner-image"] === undefined - ? defaultRunnerImages.filter((image) => + ? Object.values(DEFAULT_RUNNER_IMAGES).filter((image) => image.startsWith(operatingSystem), ) : [operatingSystemConfig["runner-image"]];