Skip to content

Commit 0152fb5

Browse files
authored
branch name handling in workflow
1 parent 0611e4b commit 0152fb5

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

.github/workflows/generate-bindings.yml

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,8 @@ jobs:
9595
git remote set-url origin https://x-access-token:${{ secrets.GITHUB_TOKEN }}@github.com/${{ github.repository }}
9696
git fetch origin
9797
98-
if gh pr list --head "update-bindings-${{ matrix.ros_distribution }}" --state open --json number --jq length | grep -q '^0$'; then
98+
BRANCH_NAME="update-bindings-${{ matrix.ros_distribution }}"
99+
if gh pr list --head "$BRANCH_NAME" --state open --json number --jq length | grep -q '^0$'; then
99100
echo "No existing PR found, will create new one"
100101
CREATE_PR=1
101102
else
@@ -106,10 +107,14 @@ jobs:
106107
git add rclrs/src/rcl_bindings_generated_${{ matrix.ros_distribution }}.rs
107108
git commit -m "Regenerate bindings for ${{ matrix.ros_distribution }}"
108109
109-
git push -f origin HEAD:refs/heads/update-bindings-${{ matrix.ros_distribution }}
110+
git push -f origin HEAD:refs/heads/$BRANCH_NAME
110111
111112
if [ $CREATE_PR -eq 1 ]; then
112-
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 }}."
113+
gh pr create \
114+
--base main \
115+
--head "$BRANCH_NAME" \
116+
--title "Regenerate bindings for ${{ matrix.ros_distribution }}" \
117+
--body "This PR regenerates the bindings for ${{ matrix.ros_distribution }}."
113118
else
114119
echo "PR already exists and has been updated with new commit"
115120
fi

0 commit comments

Comments
 (0)