INNER CODE UNIT · Python
wait_for_publish_window
keiyoushi/extensions-source · .github/scripts/cleanup-releases.py:55
def wait_for_publish_window() -> None:
while True:
runs = get_workflow_runs()
active_runs = [run for run in runs if run["status"] != "completed"]
if active_runs:
run = active_runs[0]
print(f"CI run {run['id']} is {run['status']}; checking again in 60s")
time.sleep(POLL_INTERVAL)
continue
job = get_latest_publish_job(runs)
if job is None:
print("No previous publish job found")
return
safe_at = datetime.fromisoformat(job["completed_at"]) + MIN_PUBLISH_AGE
remaining = (safe_at - datetime.now(UTC)).total_seconds()
if remaining <= 0: