Skip to content

Commit 95ff017

Browse files
authored
RSDK-10294 & RSDK-9902 - automatically merge proto PRs when tests pass (#879)
1 parent e143abc commit 95ff017

File tree

2 files changed

+38
-8
lines changed

2 files changed

+38
-8
lines changed

.github/workflows/test.yml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,3 +54,13 @@ jobs:
5454

5555
- name: Test Documentation
5656
run: uv run make test_docs
57+
58+
test_passing:
59+
if: github.repository_owner == 'viamrobotics'
60+
needs: test
61+
runs-on: ubuntu-latest
62+
steps:
63+
- name: Check Results
64+
run: |
65+
echo Python tests: ${{ needs.test.result }}
66+
[ "${{ needs.test.result }}" == "success" ]

.github/workflows/update_protos.yml

Lines changed: 28 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -44,15 +44,35 @@ jobs:
4444
run: uv run make format
4545

4646
- name: Add + Commit + Open PR
47-
shell: bash
48-
run: |
49-
git checkout -b workflow/update-protos || git checkout workflow/update-protos
50-
git add --all
51-
git -c author.name=viambot -c [email protected] -c committer.name=GitHub -c [email protected] commit -m "[WORKFLOW] Updating protos from ${{ github.event.client_payload.repo_name }}, commit: ${{ github.event.client_payload.sha }}"
52-
git -c pull.ff=only pull origin workflow/update-protos || true # do not fail if the branch doesn't exist
53-
git push -f origin workflow/update-protos
54-
gh pr view workflow/update-protos && gh pr reopen workflow/update-protos || gh pr create -B main -H workflow/update-protos -t "Automated Protos Update" -b "This is an auto-generated PR to update proto definitions. Check the commits to see which repos and commits are responsible for the changes" -a njooma -r njooma
47+
id: cpr
48+
uses: peter-evans/create-pull-request@v7
49+
with:
50+
commit-message: '[WORKFLOW] Updating protos from ${{ github.event.client_payload.repo_name }}, commit: ${{ github.event.client_payload.sha }}'
51+
branch: 'workflow/update-protos'
52+
delete-branch: true
53+
title: Automated Protos Update
54+
body: This is an auto-generated PR to update proto definitions. Check the commits to see which repos and commits are responsible for the changes
55+
assignees: njooma
56+
reviewers: njooma
57+
token: ${{ secrets.GIT_ACCESS_TOKEN }}
58+
59+
- name: Enable Pull Request Automerge
60+
if: steps.cpr.outputs.pull-request-operation == 'created'
61+
uses: peter-evans/enable-pull-request-automerge@v3
62+
with:
63+
token: ${{ secrets.GIT_ACCESS_TOKEN }}
64+
pull-request-number: ${{ steps.cpr.outputs.pull-request-number }}
65+
merge-method: squash
66+
67+
- name: Auto approve
68+
if: steps.cpr.outputs.pull-request-operation == 'created'
69+
run: gh pr review --approve "${{ stps.cpr.outputs.pull-request-number }}"
5570
env:
71+
# (TODO ethan) hard to test for sure but it's possible this is insufficient. it's unclear
72+
# to me whether an approval from `viambot` is sufficient to satisfy merge requirements.
73+
# if not, then this won't work. but that's not particularly bad! it just means we'll still
74+
# have to merge by hand, but then we can add `viambot` as a code owner and then automatic
75+
# merging will start to work.
5676
GH_TOKEN: ${{ secrets.GIT_ACCESS_TOKEN }}
5777

5878
- name: Notify slack of failure

0 commit comments

Comments
 (0)