Skip to content

Commit f0b3ee1

Browse files
committed
fix: configure token so that CI job can push branches
Signed-off-by: Esteve Fernandez <[email protected]>
1 parent 9da03ea commit f0b3ee1

File tree

1 file changed

+13
-2
lines changed

1 file changed

+13
-2
lines changed

.github/workflows/generate-bindings.yml

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,9 @@ jobs:
3838
ros_distribution: rolling
3939
ros_version: 2
4040
runs-on: ubuntu-latest
41+
permissions:
42+
contents: write
43+
pull-requests: write
4144
container:
4245
image: ${{ matrix.docker_image }}
4346
steps:
@@ -67,16 +70,24 @@ jobs:
6770
6871
- name: Submit PR
6972
run: |
73+
if git diff --exit-code; then
74+
exit 0
75+
fi
7076
git config --global user.email "[email protected]"
7177
git config --global user.name "GitHub Action"
78+
git remote set-url origin https://x-access-token:${{ secrets.GITHUB_TOKEN }}@github.com/${{ github.repository }}
79+
git remote update origin
7280
CREATE_PR=0
7381
if !git checkout update-bindings-${{ matrix.ros_distribution }}; then
7482
CREATE_PR=1
7583
git checkout -b update-bindings-${{ matrix.ros_distribution }}
7684
fi
77-
git add .
85+
git add rclrs/src/rcl_bindings_generated_${{ matrix.ros_distribution }}.rs
7886
git commit -m "Regenerate bindings for ${{ matrix.ros_distribution }}"
7987
git push -u origin update-bindings-${{ matrix.ros_distribution }}
8088
if [ $CREATE_PR -eq 1 ]; then
8189
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 }}."
82-
fi
90+
fi
91+
env:
92+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
93+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

0 commit comments

Comments
 (0)