Skip to content

Commit dde21e8

Browse files
authored
Merge pull request #49 from nickcopi/setup-ratelimit-fix
[FIX] Prevent rate limiting by changing setup.py to only reach out to the GitHub api to get the latest codeql cli version if args.check_latest_cli is set
2 parents 4632664 + b18642c commit dde21e8

File tree

1 file changed

+8
-7
lines changed

1 file changed

+8
-7
lines changed

container/setup.py

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -39,14 +39,15 @@ def setup():
3939
get_latest_codeql(args)
4040
logger.info("End setup...")
4141
def get_latest_codeql(args):
42-
# what version do we have?
4342
codeql = CodeQL(CODEQL_HOME)
44-
current_installed_version = codeql.get_current_local_version()
45-
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)
43+
# what version do we have?
44+
if args.check_latest_cli:
45+
current_installed_version = codeql.get_current_local_version()
46+
logger.info(f'Current codeql version: {current_installed_version}')
47+
latest_online_version = codeql.get_latest_codeql_github_version()
48+
if current_installed_version != latest_online_version.title:
49+
# we got a newer version online, download and install it
50+
codeql.download_and_install_latest_codeql(latest_online_version)
5051
# get the latest queries regardless (TODO: Optimize by storing and checking the last commit hash?)
5152
if args.check_latest_queries:
5253
codeql.download_and_install_latest_codeql_queries()

0 commit comments

Comments
 (0)