@@ -137,6 +137,14 @@ interface LanguageSetup {
137137/** Describes partial mappings from built-in languages to their specific setup information. */
138138type LanguageSetups = Partial < Record < BuiltInLanguage , LanguageSetup > > ;
139139
140+ // A type representing version identifiers.
141+ type Version =
142+ | "default"
143+ | "linked"
144+ | "nightly-latest"
145+ // This is an approximation, but sufficient validation for our needs here.
146+ | `stable-v${number } .${number } .${number } `;
147+
140148// The default set of CodeQL Bundle versions to use for the PR checks.
141149const defaultTestVersions = [
142150 // The oldest supported CodeQL version. If bumping, update `CODEQL_MINIMUM_VERSION` in `codeql.ts`
@@ -159,7 +167,10 @@ const defaultTestVersions = [
159167 "linked" ,
160168 // A nightly build directly from the our private repo, built in the last 24 hours.
161169 "nightly-latest" ,
162- ] ;
170+ ] as const satisfies Version [ ] ;
171+
172+ /** A type representing the default test versions. */
173+ type DefaultTestVersion = ( typeof defaultTestVersions ) [ number ] ;
163174
164175/** The default versions we use for languages / frameworks, if not specified as a workflow input. */
165176const defaultLanguageVersions = {
@@ -445,7 +456,13 @@ function generateJobMatrix(
445456 // stable-v2.20.7 requires an older version of Java than the default on `ubuntu-latest`.
446457 // We could install that older version on the newer runners, or use the older runner.
447458 // We do the latter here. This can be removed once we stop supporting `v2.20.7`.
448- if ( runnerImage === "ubuntu-latest" && version === "stable-v2.20.7" ) {
459+ // Since this is typed as `DefaultTestVersion`, it will become an error once `stable-v2.20.7`
460+ // is removed from `defaultTestVersions`.
461+ const requiresOlderRunnerImage : DefaultTestVersion = "stable-v2.20.7" ;
462+ if (
463+ runnerImage === "ubuntu-latest" &&
464+ version === requiresOlderRunnerImage
465+ ) {
449466 matrix . push ( { os : "ubuntu-24.04" , version } ) ;
450467 } else {
451468 matrix . push ( {
0 commit comments