File tree Expand file tree Collapse file tree 1 file changed +21
-1
lines changed
images/windows/scripts/build Expand file tree Collapse file tree 1 file changed +21
-1
lines changed Original file line number Diff line number Diff line change 33# # Desc: Install the CodeQL CLI Bundle to the toolcache.
44# ###############################################################################
55
6+ # Retrieve the latest major version of the CodeQL Action to use in the base URL for downloading the bundle.
7+ $releases = Invoke-RestMethod - Uri " https://api.github.com/repos/github/codeql-action/releases"
8+
9+ # Get the release tags starting with v[0-9] and sort them in descending order, then parse the first one to get the major version.
10+ $latestTag = $releases.tag_name |
11+ Where-Object { $_ -match ' ^v[0-9]' } |
12+ Sort-Object { [version ]($_ -replace ' ^v' , ' ' ) } - Descending |
13+ Select-Object - First 1
14+
15+ if ([string ]::IsNullOrEmpty($latestTag )) {
16+ Write-Error " Error: Unable to find the latest major version of the CodeQL Action."
17+ exit 1
18+ }
19+ if ($latestTag -match ' ^v([0-9]+)' ) {
20+ $codeqlActionLatestMajorVersion = $matches [1 ]
21+ } else {
22+ Write-Error " Error: Unable to parse the major version from the latest tag."
23+ exit 1
24+ }
25+
626# Retrieve the CLI version of the latest CodeQL bundle.
7- $defaults = (Invoke-RestMethod " https://raw.githubusercontent.com/github/codeql-action/v3 /src/defaults.json" )
27+ $defaults = (Invoke-RestMethod " https://raw.githubusercontent.com/github/codeql-action/v $ ( $codeqlActionLatestMajorVersion ) /src/defaults.json" )
828$cliVersion = $defaults.cliVersion
929$tagName = " codeql-bundle-v" + $cliVersion
1030
You can’t perform that action at this time.
0 commit comments