@@ -136,7 +136,7 @@ def get_test_builds(releases: List[Revision]):
136136 continue
137137
138138 artifacts = get_workflow_run_artifact_names (run .id )
139- if not artifacts :
139+ if not artifacts or any ( a for a in artifacts if a . expired ) :
140140 continue
141141
142142 revisions .append (
@@ -184,10 +184,10 @@ def get_release_package_url(tag):
184184def download_release (tag : str ):
185185 url = get_release_package_url (tag )
186186 dest = releases_dir / tag
187- if dest .exists ():
187+ if dest .exists () and list ( dest . glob ( '*' )) :
188188 return dest
189189
190- dest .mkdir (parents = True )
190+ dest .mkdir (parents = True , exist_ok = True )
191191 print (f'downloading release { tag } ' )
192192
193193 r = requests .get (url )
@@ -233,10 +233,10 @@ def download_artifact(gh, repo, artifact, dest):
233233
234234def download_test_build (workflow_run : WorkflowRun ):
235235 dest : Path = test_builds_dir / workflow_run .head_sha
236- if dest .exists ():
236+ if dest .exists () and list ( dest . glob ( '*' )) :
237237 return dest
238238
239- dest .mkdir (parents = True )
239+ dest .mkdir (parents = True , exist_ok = True )
240240 print (f'downloading test build { workflow_run .head_sha } ' )
241241
242242 found_artifact = None
@@ -257,7 +257,7 @@ def download_test_build(workflow_run: WorkflowRun):
257257
258258 download_dir = tempfile .TemporaryDirectory ()
259259 download_artifact (gh , 'ZQuestClassic/ZQuestClassic' ,
260- artifact , download_dir .name )
260+ found_artifact , download_dir .name )
261261 # Build artifacts have a single file, which is an archive.
262262 archive_path = next (Path (download_dir .name ).glob ('*' ))
263263
0 commit comments