mirror of
https://github.com/actions/runner-images.git
synced 2025-12-14 13:17:54 +00:00
Always use the latest major version of CodeQL Action
This commit is contained in:
@@ -6,9 +6,23 @@
|
|||||||
|
|
||||||
source ~/utils/utils.sh
|
source ~/utils/utils.sh
|
||||||
|
|
||||||
|
# Retrieve the latest major version of the CodeQL Action to use in the base URL for downloading the bundle.
|
||||||
|
releases=$(curl -s "https://api.github.com/repos/github/codeql-action/releases")
|
||||||
|
|
||||||
|
# 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.
|
||||||
|
codeql_action_latest_major_version=$(echo "$releases" |
|
||||||
|
jq -r '.[].tag_name' |
|
||||||
|
grep -E '^v[0-9]' |
|
||||||
|
sort -nr |
|
||||||
|
head -n 1 |
|
||||||
|
sed -E 's/^v([0-9]+).*/\1/')
|
||||||
|
if [ -z "$codeql_action_latest_major_version" ]; then
|
||||||
|
echo "Error: Unable to find the latest major version of the CodeQL Action."
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
# Retrieve the CLI version of the latest CodeQL bundle.
|
# Retrieve the CLI version of the latest CodeQL bundle.
|
||||||
defaults_json_path=$(download_with_retry https://raw.githubusercontent.com/github/codeql-action/v3/src/defaults.json)
|
defaults_json_path=$(download_with_retry "https://raw.githubusercontent.com/github/codeql-action/$codeql_action_latest_major_version/src/defaults.json")
|
||||||
bundle_version=$(jq -r '.cliVersion' $defaults_json_path)
|
|
||||||
bundle_tag_name="codeql-bundle-v$bundle_version"
|
bundle_tag_name="codeql-bundle-v$bundle_version"
|
||||||
|
|
||||||
echo "Downloading CodeQL bundle $bundle_version..."
|
echo "Downloading CodeQL bundle $bundle_version..."
|
||||||
|
|||||||
Reference in New Issue
Block a user