mirror of
https://github.com/PX4/PX4-Autopilot.git
synced 2026-05-30 18:06:39 +08:00
ci(ros): clone px4-ros2-interface-lib using PR base branch
The previous logic used GITHUB_HEAD_REF, which on a pull request is the source (PR author's) branch name. For backport PRs (e.g. mrpollo/backport-26781-1.17), no matching branch exists in px4-ros2-interface-lib, so the script fell back to main and the build broke from uORB message divergence. Switch to GITHUB_BASE_REF, which on a PR is the branch the code is being merged into (main or release/X.Y), and fall back to GITHUB_REF_NAME for direct pushes. This always resolves to a real branch in px4-ros2-interface-lib. Signed-off-by: Ramon Roche <mrpollo@gmail.com>
This commit is contained in:
@@ -89,7 +89,9 @@ jobs:
|
|||||||
. /opt/ros/galactic/setup.bash
|
. /opt/ros/galactic/setup.bash
|
||||||
mkdir -p /opt/px4_ws/src
|
mkdir -p /opt/px4_ws/src
|
||||||
cd /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"
|
REPO_URL="https://github.com/Auterion/px4-ros2-interface-lib.git"
|
||||||
if git ls-remote --heads "$REPO_URL" "$BRANCH" | grep -q "$BRANCH"; then
|
if git ls-remote --heads "$REPO_URL" "$BRANCH" | grep -q "$BRANCH"; then
|
||||||
echo "Cloning px4-ros2-interface-lib with matching branch: $BRANCH"
|
echo "Cloning px4-ros2-interface-lib with matching branch: $BRANCH"
|
||||||
|
|||||||
Reference in New Issue
Block a user