Skip to content

Commit 1f14cff

Browse files
Move CodeQL latest version query behind CLI arg
1 parent 4632664 commit 1f14cff

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

container/setup.py

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -43,10 +43,12 @@ def get_latest_codeql(args):
4343
codeql = CodeQL(CODEQL_HOME)
4444
current_installed_version = codeql.get_current_local_version()
4545
logger.info(f'Current codeql version: {current_installed_version}')
46-
latest_online_version = codeql.get_latest_codeql_github_version()
47-
if current_installed_version != latest_online_version.title and args.check_latest_cli:
48-
# we got a newer version online, download and install it
49-
codeql.download_and_install_latest_codeql(latest_online_version)
46+
# ensure we only query for the latest codeql cli version if we might actually update it
47+
if args.check_latest_cli:
48+
latest_online_version = codeql.get_latest_codeql_github_version()
49+
if current_installed_version != latest_online_version.title:
50+
# we got a newer version online, download and install it
51+
codeql.download_and_install_latest_codeql(latest_online_version)
5052
# get the latest queries regardless (TODO: Optimize by storing and checking the last commit hash?)
5153
if args.check_latest_queries:
5254
codeql.download_and_install_latest_codeql_queries()

0 commit comments

Comments
 (0)