diff --git a/.github/workflows/ros_integration_tests.yml b/.github/workflows/ros_integration_tests.yml index 7629522837..f5b38292f0 100644 --- a/.github/workflows/ros_integration_tests.yml +++ b/.github/workflows/ros_integration_tests.yml @@ -89,7 +89,9 @@ jobs: . /opt/ros/galactic/setup.bash mkdir -p /opt/px4_ws/src cd /opt/px4_ws/src - BRANCH="${GITHUB_HEAD_REF:-$GITHUB_REF_NAME}" + # On a PR, target the branch we're merging into (main or release/X.Y). + # On a direct push, fall back to the branch we're running on. + BRANCH="${GITHUB_BASE_REF:-$GITHUB_REF_NAME}" REPO_URL="https://github.com/Auterion/px4-ros2-interface-lib.git" if git ls-remote --heads "$REPO_URL" "$BRANCH" | grep -q "$BRANCH"; then echo "Cloning px4-ros2-interface-lib with matching branch: $BRANCH"