mirror of
https://github.com/github/codeql.git
synced 2025-12-16 16:53:25 +01:00
Update misc/scripts/models-as-data/bulk_generate_mad.py
Co-authored-by: Simon Friis Vindum <paldepind@github.com>
This commit is contained in:
committed by
GitHub
parent
7c2612a6a1
commit
3ddca32705
@@ -281,16 +281,15 @@ def download_artifact(url: str, artifact_name: str, pat: str) -> str:
|
||||
headers = {"Authorization": f"token {pat}", "Accept": "application/vnd.github+json"}
|
||||
response = requests.get(url, stream=True, headers=headers)
|
||||
zipName = artifact_name + ".zip"
|
||||
if response.status_code == 200:
|
||||
target_zip = os.path.join(build_dir, zipName)
|
||||
with open(target_zip, "wb") as file:
|
||||
for chunk in response.iter_content(chunk_size=8192):
|
||||
file.write(chunk)
|
||||
print(f"Download complete: {target_zip}")
|
||||
return target_zip
|
||||
else:
|
||||
if response.status_code != 200:
|
||||
print(f"Failed to download file. Status code: {response.status_code}")
|
||||
sys.exit(1)
|
||||
target_zip = os.path.join(build_dir, zipName)
|
||||
with open(target_zip, "wb") as file:
|
||||
for chunk in response.iter_content(chunk_size=8192):
|
||||
file.write(chunk)
|
||||
print(f"Download complete: {target_zip}")
|
||||
return target_zip
|
||||
|
||||
|
||||
def remove_extension(filename: str) -> str:
|
||||
|
||||
Reference in New Issue
Block a user