77OWNER = "iree-org"
88REPO = "iree"
99
10- API_URL = f"https://api.github.com/repos/{ OWNER } /{ REPO } /actions/workflows/pkgci.yml/runs"
10+ API_URL = (
11+ f"https://api.github.com/repos/{ OWNER } /{ REPO } /actions/workflows/pkgci.yml/runs"
12+ )
13+
1114
1215# Get the latest workflow run ID for pkgci.yml
1316def get_latest_pkgci_workflow_run ():
@@ -35,6 +38,7 @@ def get_latest_pkgci_workflow_run():
3538 print (f"Error fetching workflow runs: { response .status_code } " )
3639 return None
3740
41+
3842# Get the artifacts of a specific workflow run
3943def get_artifacts (workflow_run_id , artifacts_url ):
4044 headers = {
@@ -50,12 +54,13 @@ def get_artifacts(workflow_run_id, artifacts_url):
5054 print (f"Artifacts for pkgci.yml workflow run { workflow_run_id } :" )
5155 for artifact in artifacts :
5256 print (f"- { artifact ['name' ]} (Size: { artifact ['size_in_bytes' ]} bytes)" )
53- download_artifact (artifact [' archive_download_url' ], artifact [' name' ])
57+ download_artifact (artifact [" archive_download_url" ], artifact [" name" ])
5458 else :
5559 print ("No artifacts found for the pkgci.yml workflow run." )
5660 else :
5761 print (f"Error fetching artifacts: { response .status_code } " )
5862
63+
5964# Download an artifact
6065def download_artifact (download_url , artifact_name ):
6166 headers = {
@@ -76,6 +81,7 @@ def download_artifact(download_url, artifact_name):
7681 else :
7782 print (f"Error downloading artifact '{ artifact_name } ': { response .status_code } " )
7883
84+
7985if __name__ == "__main__" :
8086 workflow_run_id , artifact_url = get_latest_pkgci_workflow_run ()
8187 if workflow_run_id :
0 commit comments