Skip to content

Commit 06da642

Browse files
Copilotfelickz
andauthored
Require a separator before the version in nightly-until forms; fix prerelease docs
Co-authored-by: felickz <1760475+felickz@users.noreply.github.com>
1 parent ada6eaf commit 06da642

6 files changed

Lines changed: 47 additions & 44 deletions

File tree

‎CHANGELOG.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ See the [releases page](https://github.com/github/codeql-action/releases) for th
66

77
- The `tools` input for the `init` and `setup-codeql` Actions now accepts a bare CodeQL CLI version number, for example `2.19.0` or `v2.19.0`. The Action will automatically download the CodeQL Bundle release asset that matches the runner's operating system and architecture, preferring the smaller `zstd`-compressed bundle where it is supported.
88
- The `tools` input also now accepts a CodeQL CLI version range, for example `2.24.x`, `2.x`, `~2.24.0`, or `^2.24.0`, as well as `latest-<N>` (for example `latest-1`), which resolves to the CodeQL Bundle release `N` stable releases before the most recent one.
9-
- The `tools` input also now accepts `latest-prerelease`, which resolves to the most recent CodeQL Bundle release, whether it is a stable release or a GitHub prerelease, as well as `nightly-until<version>` and `nightly-until-stable<version>` (for example `nightly-until2.24.0`), which resolve to the most recent CodeQL Bundle release satisfying that version threshold, or fall back to the latest nightly version of the CodeQL tools if no such release exists.
9+
- The `tools` input also now accepts `latest-prerelease`, which resolves to the most recent CodeQL Bundle release, whether it is a stable release or a GitHub prerelease, as well as `nightly-until-<version>` and `nightly-until-stable-<version>` (for example `nightly-until-2.24.0`), which resolve to the most recent CodeQL Bundle release satisfying that version threshold, considering GitHub prereleases too unless `-stable` is specified, or fall back to the latest nightly version of the CodeQL tools if no such release exists.
1010

1111
## 4.37.5 - 03 Aug 2026
1212

‎init/action.yml‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,8 @@ inputs:
2020
uses the CodeQL Bundle release `N` stable releases before the most recent one, or
2121
- A special value `latest-prerelease` (matching is case insensitive) which uses the most
2222
recent CodeQL Bundle release, whether it is a stable release or a GitHub prerelease, or
23-
- `nightly-until<version>` or `nightly-until-stable<version>`, for example
24-
`nightly-until2.24.0` or `NIGHTLY-UNTIL-STABLE2.24.0` (matching is case insensitive),
23+
- `nightly-until-<version>` or `nightly-until-stable-<version>`, for example
24+
`nightly-until-2.24.0` or `NIGHTLY-UNTIL-STABLE-2.24.0` (matching is case insensitive),
2525
which uses the most recent CodeQL Bundle release satisfying that version threshold,
2626
considering GitHub prereleases too unless `-stable` is specified, or falls back to the
2727
latest nightly version of the CodeQL tools if no such release exists, or

‎lib/entry-points.js‎

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎setup-codeql/action.yml‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,8 @@ inputs:
2020
uses the CodeQL Bundle release `N` stable releases before the most recent one, or
2121
- A special value `latest-prerelease` (matching is case insensitive) which uses the most
2222
recent CodeQL Bundle release, whether it is a stable release or a GitHub prerelease, or
23-
- `nightly-until<version>` or `nightly-until-stable<version>`, for example
24-
`nightly-until2.24.0` or `NIGHTLY-UNTIL-STABLE2.24.0` (matching is case insensitive),
23+
- `nightly-until-<version>` or `nightly-until-stable-<version>`, for example
24+
`nightly-until-2.24.0` or `NIGHTLY-UNTIL-STABLE-2.24.0` (matching is case insensitive),
2525
which uses the most recent CodeQL Bundle release satisfying that version threshold,
2626
considering GitHub prereleases too unless `-stable` is specified, or falls back to the
2727
latest nightly version of the CodeQL tools if no such release exists, or

‎src/setup-codeql.test.ts‎

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -421,7 +421,7 @@ function mockListStableCodeQLBundleReleases(
421421
/**
422422
* As `mockListStableCodeQLBundleReleases`, but additionally mocks the CodeQL nightlies
423423
* repository's release list, so that fallback to the latest nightly bundle can be tested when no
424-
* release satisfies a `nightly-until<version>` or `nightly-until-stable<version>` version
424+
* release satisfies a `nightly-until-<version>` or `nightly-until-stable-<version>` version
425425
* threshold.
426426
*/
427427
function mockListCodeQLBundleReleasesWithNightlyFallback(
@@ -620,7 +620,7 @@ test.serial(
620620

621621
/**
622622
* A set of CodeQL bundle releases that includes GitHub prereleases, used to test resolution of
623-
* the `latest-prerelease` and `nightly-until<version>`/`nightly-until-stable<version>` forms of
623+
* the `latest-prerelease` and `nightly-until-<version>`/`nightly-until-stable-<version>` forms of
624624
* the `tools` input in the case where the newest release overall is a stable release, even though
625625
* prereleases exist. `STABLE_BUNDLE_RELEASES_TEST_SET` above covers the opposite case, where the
626626
* newest release overall is a prerelease.
@@ -728,49 +728,49 @@ test.serial(
728728
const NIGHTLY_UNTIL_RESOLVES_TOOLS_INPUT_TEST_CASES = [
729729
{
730730
name: "threshold exactly matches the newest release, which is a prerelease",
731-
toolsInput: "nightly-until2.26.0",
731+
toolsInput: "nightly-until-2.26.0",
732732
releases: STABLE_BUNDLE_RELEASES_TEST_SET,
733733
expectedCliVersion: "2.26.0",
734734
},
735735
{
736736
name: "the newest release comfortably exceeds the threshold",
737-
toolsInput: "nightly-until2.20.0",
737+
toolsInput: "nightly-until-2.20.0",
738738
releases: STABLE_BUNDLE_RELEASES_TEST_SET,
739739
expectedCliVersion: "2.26.0",
740740
},
741741
{
742742
name: "a prerelease is selected since it is the newest release satisfying the threshold, even though no stable release would satisfy it",
743-
toolsInput: "nightly-until2.25.4",
743+
toolsInput: "nightly-until-2.25.4",
744744
releases: STABLE_BUNDLE_RELEASES_TEST_SET,
745745
expectedCliVersion: "2.26.0",
746746
},
747747
{
748748
name: "matching is case insensitive",
749-
toolsInput: "NIGHTLY-UNTIL2.25.4",
749+
toolsInput: "NIGHTLY-UNTIL-2.25.4",
750750
releases: STABLE_BUNDLE_RELEASES_TEST_SET,
751751
expectedCliVersion: "2.26.0",
752752
},
753753
{
754754
name: "drafts and date-tagged releases are excluded even when they would otherwise be the newest",
755-
toolsInput: "nightly-until2.20.0",
755+
toolsInput: "nightly-until-2.20.0",
756756
releases: PRERELEASE_BUNDLE_RELEASES_TEST_SET,
757757
expectedCliVersion: "2.27.0",
758758
},
759759
{
760760
name: "nightly-until-stable: threshold exactly matches the newest stable release",
761-
toolsInput: "nightly-until-stable2.25.3",
761+
toolsInput: "nightly-until-stable-2.25.3",
762762
releases: STABLE_BUNDLE_RELEASES_TEST_SET,
763763
expectedCliVersion: "2.25.3",
764764
},
765765
{
766766
name: "nightly-until-stable: the newest stable release comfortably exceeds the threshold",
767-
toolsInput: "nightly-until-stable2.20.0",
767+
toolsInput: "nightly-until-stable-2.20.0",
768768
releases: STABLE_BUNDLE_RELEASES_TEST_SET,
769769
expectedCliVersion: "2.25.3",
770770
},
771771
{
772772
name: "nightly-until-stable: matching is case insensitive",
773-
toolsInput: "NIGHTLY-UNTIL-STABLE2.25.3",
773+
toolsInput: "NIGHTLY-UNTIL-STABLE-2.25.3",
774774
releases: STABLE_BUNDLE_RELEASES_TEST_SET,
775775
expectedCliVersion: "2.25.3",
776776
},
@@ -814,11 +814,11 @@ for (const {
814814
const NIGHTLY_UNTIL_FALLBACK_TOOLS_INPUT_TEST_CASES = [
815815
{
816816
name: "no release, stable or prerelease, satisfies the threshold",
817-
toolsInput: "nightly-until9.0.0",
817+
toolsInput: "nightly-until-9.0.0",
818818
},
819819
{
820820
name: "only a prerelease, not a stable release, would satisfy the threshold",
821-
toolsInput: "nightly-until-stable2.25.4",
821+
toolsInput: "nightly-until-stable-2.25.4",
822822
},
823823
] as const;
824824

@@ -881,9 +881,9 @@ for (const {
881881
}
882882

883883
const MALFORMED_NIGHTLY_UNTIL_THRESHOLD_TOOLS_INPUT_TEST_CASES = [
884-
{ toolsInput: "nightly-untilbogus", expectedRawThreshold: "bogus" },
884+
{ toolsInput: "nightly-until-bogus", expectedRawThreshold: "bogus" },
885885
{
886-
toolsInput: "nightly-until-stablebogus",
886+
toolsInput: "nightly-until-stable-bogus",
887887
expectedRawThreshold: "bogus",
888888
},
889889
] as const;

‎src/setup-codeql.ts‎

Lines changed: 27 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -60,13 +60,13 @@ const LATEST_OFFSET_TOOLS_INPUT_REGEX = /^latest-(\d+)$/i;
6060
const LATEST_PRERELEASE_TOOLS_INPUT = "latest-prerelease";
6161

6262
/**
63-
* Matches the `nightly-until<version>` and `nightly-until-stable<version>` forms of the `tools`
64-
* input, for example `nightly-until2.24.0` or `NIGHTLY-UNTIL-STABLE2.24.0` (matching is case
65-
* insensitive). Capture group 1 is `-stable` if the `-stable` variant was used, or `undefined`
66-
* otherwise. Capture group 2 is the raw version threshold, which this regular expression does not
67-
* validate: see `parseNightlyUntilThreshold`.
63+
* Matches the `nightly-until-<version>` and `nightly-until-stable-<version>` forms of the
64+
* `tools` input, for example `nightly-until-2.24.0` or `NIGHTLY-UNTIL-STABLE-2.24.0` (matching is
65+
* case insensitive). Capture group 1 is `-stable` if the `-stable` variant was used, or
66+
* `undefined` otherwise. Capture group 2 is the raw version threshold, which this regular
67+
* expression does not validate: see `parseNightlyUntilThreshold`.
6868
*/
69-
const NIGHTLY_UNTIL_TOOLS_INPUT_REGEX = /^nightly-until(-stable)?(.+)$/i;
69+
const NIGHTLY_UNTIL_TOOLS_INPUT_REGEX = /^nightly-until(-stable)?-(.+)$/i;
7070

7171
/** Number of releases requested per page when listing CodeQL bundle releases. */
7272
const CODEQL_BUNDLE_RELEASE_LIST_PAGE_SIZE = 100;
@@ -300,16 +300,17 @@ function tryGetCliVersionRangeFromToolsInput(
300300
* `true`. Otherwise returns `false`.
301301
*
302302
* `latest-prerelease` refers to the newest semantically versioned CodeQL bundle release, whether
303-
* it is a stable release or a GitHub prerelease. This is the only `tools` input form that may
304-
* resolve to a prerelease: every other form only ever considers stable releases.
303+
* it is a stable release or a GitHub prerelease. Along with the non-`-stable` form of
304+
* `nightly-until-<version>`, this is one of the two `tools` input forms that may resolve to a
305+
* prerelease: every other form only ever considers stable releases.
305306
*/
306307
function isLatestPrereleaseToolsInput(toolsInput: string): boolean {
307308
return toolsInput.toLowerCase() === LATEST_PRERELEASE_TOOLS_INPUT;
308309
}
309310

310311
/**
311-
* If the `tools` input matches the `nightly-until<version>` or `nightly-until-stable<version>`
312-
* syntax, for example `nightly-until2.24.0` or `NIGHTLY-UNTIL-STABLE2.24.0` (matching is case
312+
* If the `tools` input matches the `nightly-until-<version>` or `nightly-until-stable-<version>`
313+
* syntax, for example `nightly-until-2.24.0` or `NIGHTLY-UNTIL-STABLE-2.24.0` (matching is case
313314
* insensitive), returns the raw version threshold (not yet validated as a semantic version: see
314315
* `parseNightlyUntilThreshold`) and whether only stable releases should be considered when
315316
* resolving that threshold. Otherwise returns `undefined`.
@@ -324,8 +325,8 @@ function tryGetNightlyUntilToolsInput(
324325
}
325326

326327
/**
327-
* Validates that `rawThreshold`, extracted from the `nightly-until<version>` or
328-
* `nightly-until-stable<version>` form of the `tools` input by `tryGetNightlyUntilToolsInput`, is
328+
* Validates that `rawThreshold`, extracted from the `nightly-until-<version>` or
329+
* `nightly-until-stable-<version>` form of the `tools` input by `tryGetNightlyUntilToolsInput`, is
329330
* a valid semantic version, and returns it normalized to the `x.y.z` form. A version threshold
330331
* that isn't a valid semantic version can never be compared against the available releases, so
331332
* this throws a `ConfigurationError` describing the problem.
@@ -410,7 +411,7 @@ async function getSortedStableCliVersions(logger: Logger): Promise<string[]> {
410411
* semantic-version order (newest first). See `getSortedCliVersions` for details.
411412
*
412413
* This is only used to resolve `tools` input forms, such as `latest-prerelease` and
413-
* `nightly-until<version>`, that explicitly opt in to considering prereleases. Every other
414+
* `nightly-until-<version>`, that explicitly opt in to considering prereleases. Every other
414415
* `tools` input form uses `getSortedStableCliVersions` instead, so can never be resolved to a
415416
* prerelease.
416417
*/
@@ -640,12 +641,13 @@ async function resolveDefaultCliVersion(
640641
* `CODEQL_NIGHTLY_TOOLS_INPUTS`, `CODEQL_BUNDLE_VERSION_ALIAS`, and `CODEQL_TOOLCACHE_INPUT`
641642
* below).
642643
* 3. `latest-prerelease`: the newest semantically versioned CodeQL bundle release, whether it
643-
* is a stable release or a GitHub prerelease (see `isLatestPrereleaseToolsInput`). This is
644-
* the only category that may resolve to a prerelease.
645-
* 4. `nightly-until<version>` or `nightly-until-stable<version>`, e.g. `nightly-until2.24.0` or
646-
* `nightly-until-stable2.24.0`: the newest release at or above that version threshold, among
647-
* stable releases and, unless `-stable` is used, GitHub prereleases too; or the latest
648-
* nightly bundle if no such release exists (see `tryGetNightlyUntilToolsInput`).
644+
* is a stable release or a GitHub prerelease (see `isLatestPrereleaseToolsInput`).
645+
* 4. `nightly-until-<version>` or `nightly-until-stable-<version>`, e.g. `nightly-until-2.24.0`
646+
* or `nightly-until-stable-2.24.0`: the newest release at or above that version threshold,
647+
* among stable releases and, unless `-stable` is used, GitHub prereleases too; or the latest
648+
* nightly bundle if no such release exists (see `tryGetNightlyUntilToolsInput`). Along with
649+
* `latest-prerelease`, the non-`-stable` form of this category is the only other one that
650+
* may resolve to a prerelease.
649651
* 5. A URL, i.e. a string starting with `http`: the CodeQL Bundle downloaded from that URL.
650652
* 6. A bare CLI version number, e.g. `2.19.0` or `v2.19.0`: the CodeQL Bundle release
651653
* containing that CLI version (see `tryGetCliVersionFromToolsInput`).
@@ -688,8 +690,8 @@ export async function getCodeQLSource(
688690
): Promise<CodeQLToolsSource> {
689691
// If there is an explicit `tools` input, it's not one of the reserved values, it doesn't appear
690692
// to point to a URL, and it isn't a bare CodeQL CLI version number, a `latest-<N>` version
691-
// offset, a semantic version range, `latest-prerelease`, or `nightly-until<version>`/
692-
// `nightly-until-stable<version>`, then we assume it is a local path and use the CLI from
693+
// offset, a semantic version range, `latest-prerelease`, or `nightly-until-<version>`/
694+
// `nightly-until-stable-<version>`, then we assume it is a local path and use the CLI from
693695
// there. See the order-of-operations note in this function's doc comment above for the full
694696
// list of categories and why a URL is never confused with a version number or a range.
695697
// TODO: This appears to misclassify filenames that happen to start with `http` as URLs.
@@ -777,8 +779,9 @@ export async function getCodeQLSource(
777779
isLatestPrereleaseToolsInput(toolsInput)
778780
) {
779781
// The `latest-prerelease` syntax was used to request the newest semantically versioned
780-
// CodeQL bundle release, whether it is a stable release or a GitHub prerelease. This is the
781-
// only `tools` input form that may resolve to a prerelease.
782+
// CodeQL bundle release, whether it is a stable release or a GitHub prerelease. Along with
783+
// the non-`-stable` form of `nightly-until-<version>`, this is one of the two `tools` input
784+
// forms that may resolve to a prerelease.
782785
const sortedVersions =
783786
await getSortedCliVersionsIncludingPrereleases(logger);
784787

@@ -797,7 +800,7 @@ export async function getCodeQLSource(
797800
toolsInput !== undefined &&
798801
tryGetNightlyUntilToolsInput(toolsInput) !== undefined
799802
) {
800-
// The `nightly-until<version>` or `nightly-until-stable<version>` syntax was used: use the
803+
// The `nightly-until-<version>` or `nightly-until-stable-<version>` syntax was used: use the
801804
// newest release at or above the given version threshold, among stable releases and, unless
802805
// `-stable` was specified, GitHub prereleases too. If no release satisfies the threshold,
803806
// fall back to the latest nightly bundle.

0 commit comments

Comments
 (0)