File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -40,12 +40,23 @@ jobs:
4040 - name : Check version pinning
4141 shell : bash
4242 run : |
43- gh codeql set-version v2.5.9
43+ # Set the version without a v prefix
44+ gh codeql set-version 2.5.9
4445 VERSION=`gh codeql version --format json | jq -r '.version'`
4546 if [[ $VERSION != "2.5.9" ]]; then
4647 echo "::error::Expected version 2.5.9 but got $VERSION"
4748 exit 1
4849 fi
50+ gh codeql list-installed | grep v2.5.9
51+
52+ # Set the version with a v prefix
53+ COUNT_BEFORE=`gh codeql list-installed | wc -l`
54+ gh codeql set-version v2.5.9
55+ COUNT_AFTER=`gh codeql list-installed | wc -l`
56+ if [[ $COUNT_BEFORE != $COUNT_BEFORE ]]; then
57+ echo "::error::Installing an already installed version changed the number of installed versions from $COUNT_BEFORE to $COUNT_AFTER!"
58+ exit 1
59+ fi
4960
5061 - name : Check version unpinning
5162 shell : bash
5667 echo "::error::Expected latest version but got 2.5.9"
5768 exit 1
5869 fi
70+
71+ - name : Check getting nightly version
72+ shell : bash
73+ run : |
74+ gh codeql set-channel nightly
75+ gh codeql set-version codeql-bundle-20210831-manual
76+ VERSION=`gh codeql version --format json | jq -r '.version'`
77+ if [[ $VERSION != "2.6.0+202108311306" ]]; then
78+ echo "::error::Expected version 2.6.0+202108311306 but got $VERSION"
79+ exit 1
80+ fi
Original file line number Diff line number Diff line change @@ -122,6 +122,10 @@ function set_version() {
122122 elif [ " $version " = " latest" ]; then
123123 version=" $( gh api " repos/$repo /releases/latest" --jq " .tag_name" ) "
124124 fi
125+ if [ $repo = ' github/codeql-cli-binaries' ] && [[ " $version " != v* ]] ; then
126+ # Versions in github/codeql-cli-binaries have tags prefixed with v; we add this in if the user forgot.
127+ version=" v$version "
128+ fi
125129 download " $version "
126130 gh config set extensions.codeql.version " $version "
127131}
141145
142146# Handle the list-installed command.
143147if [ " $1 " = " list-installed" ]; then
144- ( cd " $rootdir /dist/$channel " ; find . -depth 1 -type d | cut -c3- ; )
148+ ( cd " $rootdir /dist/$channel " ; find . -mindepth 1 -maxdepth 1 -type d | cut -c3- ; )
145149 exit 0
146150fi
147151
You can’t perform that action at this time.
0 commit comments