summaryrefslogtreecommitdiff
path: root/ci
diff options
context:
space:
mode:
authorNed Batchelder <ned@nedbatchelder.com>2020-12-19 16:51:38 -0500
committerNed Batchelder <ned@nedbatchelder.com>2020-12-19 16:51:38 -0500
commitf1dc6ccf94fafb7932a3c8d1a3e81dee2dcc808e (patch)
treecb78468a0a395d61c19831037d2b5022026c1137 /ci
parentc377e65f45e91499d9f25916851e0c2943fa202d (diff)
downloadpython-coveragepy-git-f1dc6ccf94fafb7932a3c8d1a3e81dee2dcc808e.tar.gz
Name kit artifacts
Without a name, the download program will grab the latest artifacts no matter what they are, like .coverage data files from metacov. This ensures we get the kits.
Diffstat (limited to 'ci')
-rw-r--r--ci/download_gha_artifacts.py15
1 files changed, 9 insertions, 6 deletions
diff --git a/ci/download_gha_artifacts.py b/ci/download_gha_artifacts.py
index ac9d4790..5e86d243 100644
--- a/ci/download_gha_artifacts.py
+++ b/ci/download_gha_artifacts.py
@@ -49,9 +49,12 @@ if not os.path.exists(dest):
os.chdir(dest)
r = requests.get(f"https://api.github.com/repos/{repo_owner}/actions/artifacts")
-latest = max(r.json()["artifacts"], key=lambda a: a["created_at"])
-
-print(f"Artifacts created at {utc2local(latest['created_at'])}")
-download_url(latest["archive_download_url"], temp_zip)
-unpack_zipfile(temp_zip)
-os.remove(temp_zip)
+dists = [a for a in r.json()["artifacts"] if a["name"] == "dist"]
+if not dists:
+ print(f"No recent dists!")
+else:
+ latest = max(dists, key=lambda a: a["created_at"])
+ print(f"Artifacts created at {utc2local(latest['created_at'])}")
+ download_url(latest["archive_download_url"], temp_zip)
+ unpack_zipfile(temp_zip)
+ os.remove(temp_zip)