diff --git a/.github/workflows/distribute.yml b/.github/workflows/distribute.yml index 5e5e14e..bd7fa37 100644 --- a/.github/workflows/distribute.yml +++ b/.github/workflows/distribute.yml @@ -142,17 +142,8 @@ jobs: --event workflow_dispatch \ --limit 10 \ --json databaseId,createdAt \ - | python3 -c ' - import json - import sys - - dispatched_at = sys.argv[1] - runs = json.load(sys.stdin) - print(next( - (run["databaseId"] for run in runs if run["createdAt"] >= dispatched_at), - "", - )) - ' "$dispatched_at" + | python3 -c "import json,sys; t=sys.argv[1]; print(next((r['databaseId'] for r in json.load(sys.stdin) if r['createdAt']>=t), ''))" \ + "$dispatched_at" ) if [ -n "$run_id" ]; then break diff --git a/tests/test_release_workflows.py b/tests/test_release_workflows.py index 1aeea83..6d5f681 100644 --- a/tests/test_release_workflows.py +++ b/tests/test_release_workflows.py @@ -175,6 +175,11 @@ def test_space_pin_is_dispatched_before_the_factory_rebuild() -> None: assert "pin-library.yml" in script assert "RAIW_HF_SPACE_TOKEN secret is not set" in script assert "restart_space" in script + # Nested YAML indent inside python -c crashed 0.40.1's waiter with + # IndentationError before it could see the dispatched pin run. + waiter = re.search(r"python3 -c \"(.*?)\"", script) + assert waiter is not None + assert waiter.group(1).lstrip() == waiter.group(1) @pytest.mark.skipif(os.name != "posix" or shutil.which("bash") is None, reason="Executes an Ubuntu Bash workflow")