Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 24 additions & 8 deletions .github/workflows/generate-bindings.yml
Original file line number Diff line number Diff line change
Expand Up @@ -88,24 +88,40 @@ jobs:
cd $GITHUB_WORKSPACE
git config --global --add safe.directory $GITHUB_WORKSPACE
if git diff --exit-code; then
echo "No changes detected, skipping PR creation"
exit 0
fi

git config --global user.email "action@github.com"
git config --global user.name "GitHub Action"
git remote set-url origin https://x-access-token:${{ secrets.GITHUB_TOKEN }}@github.com/${{ github.repository }}
git remote update origin
CREATE_PR=0
if ! git checkout update-bindings-${{ matrix.ros_distribution }}; then
git fetch origin

echo "Github env set and origin is fetched! Now checking if PR exists.."

BRANCH_NAME="update-bindings-${{ matrix.ros_distribution }}"
if gh pr list --head "$BRANCH_NAME" --state open --json number --jq length | grep -q '^0$'; then
echo "No existing PR found, will create new one"
CREATE_PR=1
git checkout -b update-bindings-${{ matrix.ros_distribution }}
else
echo "PR already exists, will update it"
CREATE_PR=0
fi

git add rclrs/src/rcl_bindings_generated_${{ matrix.ros_distribution }}.rs
git commit -m "Regenerate bindings for ${{ matrix.ros_distribution }}"
git fetch origin update-bindings-${{ matrix.ros_distribution }}
git rebase origin/update-bindings-${{ matrix.ros_distribution }}
git push -u origin update-bindings-${{ matrix.ros_distribution }}

git push -f origin HEAD:refs/heads/$BRANCH_NAME

if [ $CREATE_PR -eq 1 ]; then
gh pr create --base main --head update-bindings-${{ matrix.ros_distribution }} --title "Regenerate bindings for ${{ matrix.ros_distribution }}" --body "This PR regenerates the bindings for ${{ matrix.ros_distribution }}."
gh pr create \
--base main \
--head "$BRANCH_NAME" \
--title "Regenerate bindings for ${{ matrix.ros_distribution }}" \
--body "This PR regenerates the bindings for ${{ matrix.ros_distribution }}."
echo "Created new PR!"
else
echo "PR already exists and has been updated with new commit"
fi
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
Expand Down
2 changes: 1 addition & 1 deletion rclrs/src/rcl_bindings_generated_humble.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/* automatically generated by rust-bindgen 0.70.1 */
/* automatically generated by rust-bindgen 0.72.1 */

pub type rcutils_ret_t = ::std::os::raw::c_int;
#[repr(C)]
Expand Down