Skip to content

Commit a662744

Browse files
authored
better pr detection
1 parent d359fb9 commit a662744

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

.github/workflows/generate-bindings.yml

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -94,10 +94,12 @@ jobs:
9494
git config --global user.name "GitHub Action"
9595
git remote set-url origin https://x-access-token:${{ secrets.GITHUB_TOKEN }}@github.com/${{ github.repository }}
9696
git remote update origin
97-
CREATE_PR=0
98-
if ! git checkout update-bindings-${{ matrix.ros_distribution }}; then
97+
if gh pr list --head "update-bindings-${{ matrix.ros_distribution }}" --state open --json number --jq length | grep -q '^0$'; then
98+
echo "No existing PR found, will create new one"
9999
CREATE_PR=1
100-
git checkout -b update-bindings-${{ matrix.ros_distribution }}
100+
else
101+
echo "PR already exists, will update it"
102+
CREATE_PR=0
101103
fi
102104
git add rclrs/src/rcl_bindings_generated_${{ matrix.ros_distribution }}.rs
103105
git commit -m "Regenerate bindings for ${{ matrix.ros_distribution }}"

0 commit comments

Comments
 (0)