Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 23 additions & 1 deletion .github/workflows/pr-checks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,12 +40,23 @@ jobs:
- name: Check version pinning
shell: bash
run: |
gh codeql set-version v2.5.9
# Set the version without a v prefix
gh codeql set-version 2.5.9
Comment thread
edoardopirovano marked this conversation as resolved.
Resolved
VERSION=`gh codeql version --format json | jq -r '.version'`
if [[ $VERSION != "2.5.9" ]]; then
echo "::error::Expected version 2.5.9 but got $VERSION"
exit 1
fi
gh codeql list-installed | grep v2.5.9

# Set the version with a v prefix
COUNT_BEFORE=`gh codeql list-installed | wc -l`
gh codeql set-version v2.5.9
COUNT_AFTER=`gh codeql list-installed | wc -l`
if [[ $COUNT_BEFORE != $COUNT_BEFORE ]]; then
echo "::error::Installing an already installed version changed the number of installed versions from $COUNT_BEFORE to $COUNT_AFTER!"
exit 1
fi

- name: Check version unpinning
shell: bash
Expand All @@ -56,3 +67,14 @@ jobs:
echo "::error::Expected latest version but got 2.5.9"
exit 1
fi

- name: Check getting nightly version
shell: bash
run: |
gh codeql set-channel nightly
gh codeql set-version codeql-bundle-20210831-manual
VERSION=`gh codeql version --format json | jq -r '.version'`
if [[ $VERSION != "2.6.0+202108311306" ]]; then
echo "::error::Expected version 2.6.0+202108311306 but got $VERSION"
exit 1
fi
6 changes: 5 additions & 1 deletion gh-codeql
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,10 @@ function set_version() {
elif [ "$version" = "latest" ]; then
version="$(gh api "repos/$repo/releases/latest" --jq ".tag_name")"
fi
if [ $repo = 'github/codeql-cli-binaries' ] && [[ "$version" != v* ]] ; then
# Versions in github/codeql-cli-binaries have tags prefixed with v; we add this in if the user forgot.
version="v$version"
fi
download "$version"
gh config set extensions.codeql.version "$version"
}
Expand All @@ -141,7 +145,7 @@ fi

# Handle the list-installed command.
if [ "$1" = "list-installed" ]; then
( cd "$rootdir/dist/$channel" ; find . -depth 1 -type d | cut -c3- ; )
( cd "$rootdir/dist/$channel" ; find . -mindepth 1 -maxdepth 1 -type d | cut -c3- ; )
exit 0
fi

Expand Down