From 6b39cd728485784f8e4e549a5dab067d02dde6cd Mon Sep 17 00:00:00 2001 From: JSONbored <49853598+JSONbored@users.noreply.github.com> Date: Sat, 9 May 2026 19:59:24 -0700 Subject: [PATCH] fix(ci): checkout submodules for central pr checks --- .github/workflows/control-plane.yml | 4 ++-- src/aio_fleet/poll.py | 4 +++- tests/test_control_plane_workflow.py | 4 ++-- tests/test_poll.py | 4 ++-- 4 files changed, 9 insertions(+), 7 deletions(-) diff --git a/.github/workflows/control-plane.yml b/.github/workflows/control-plane.yml index ffba497..f62d871 100644 --- a/.github/workflows/control-plane.yml +++ b/.github/workflows/control-plane.yml @@ -307,7 +307,7 @@ jobs: ref: ${{ inputs.sha }} path: app-repo fetch-depth: 0 - submodules: ${{ steps.control-check-policy.outputs.checkout_submodules == 'true' && inputs.event != 'pull_request' && 'recursive' || 'false' }} + submodules: ${{ steps.control-check-policy.outputs.checkout_submodules == 'true' && 'recursive' || 'false' }} token: ${{ steps.app-token.outputs.token }} persist-credentials: false @@ -494,7 +494,7 @@ jobs: ref: ${{ matrix.target.sha }} path: app-repo fetch-depth: 0 - submodules: ${{ matrix.target.checkout_submodules == true && matrix.target.event != 'pull_request' && 'recursive' || 'false' }} + submodules: ${{ matrix.target.checkout_submodules == true && 'recursive' || 'false' }} token: ${{ steps.app-token.outputs.token }} persist-credentials: false diff --git a/src/aio_fleet/poll.py b/src/aio_fleet/poll.py index d1f8523..a603db9 100644 --- a/src/aio_fleet/poll.py +++ b/src/aio_fleet/poll.py @@ -41,7 +41,9 @@ def poll_targets( sha=sha, event="pull_request", source=f"pr:{number}", - checkout_submodules=False, + checkout_submodules=bool( + repo.raw.get("checkout_submodules") + ), publish=False, ) ) diff --git a/tests/test_control_plane_workflow.py b/tests/test_control_plane_workflow.py index 178f78b..b825736 100644 --- a/tests/test_control_plane_workflow.py +++ b/tests/test_control_plane_workflow.py @@ -95,11 +95,11 @@ def test_app_code_checkouts_gate_submodule_checkout() -> None: assert "checkout_submodules" in manual["with"]["submodules"] # nosec B101 assert ( - "inputs.event != 'pull_request'" in manual["with"]["submodules"] + "inputs.event != 'pull_request'" not in manual["with"]["submodules"] ) # nosec B101 assert "checkout_submodules" in poll["with"]["submodules"] # nosec B101 assert ( - "matrix.target.event != 'pull_request'" in poll["with"]["submodules"] + "matrix.target.event != 'pull_request'" not in poll["with"]["submodules"] ) # nosec B101 diff --git a/tests/test_poll.py b/tests/test_poll.py index 938c4a8..f212a21 100644 --- a/tests/test_poll.py +++ b/tests/test_poll.py @@ -69,7 +69,7 @@ def test_poll_targets_require_same_repository_pr_identity( ] -def test_poll_targets_emit_checkout_submodules_only_for_main( +def test_poll_targets_emit_checkout_submodules_for_same_repo_pr_and_main( tmp_path: Path, monkeypatch ) -> None: manifest_path = _write_manifest(tmp_path, checkout_submodules=True) @@ -94,7 +94,7 @@ def test_poll_targets_emit_checkout_submodules_only_for_main( "pull_request", "push", ] - assert targets[0].checkout_submodules is False # nosec B101 + assert targets[0].checkout_submodules is True # nosec B101 assert targets[1].checkout_submodules is True # nosec B101