-
Notifications
You must be signed in to change notification settings - Fork 52
46 lines (39 loc) · 1.75 KB
/
update_protos.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
name: Update Protos + Open PR
on:
workflow_dispatch:
repository_dispatch:
types:
- protos-updated
jobs:
update-protos:
if: github.repository_owner == 'viamrobotics'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: bufbuild/[email protected]
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
- uses: arduino/setup-protoc@v1
with:
repo-token: ${{ secrets.GITHUB_TOKEN }}
- name: Install Poetry
uses: snok/install-poetry@v1
- name: Install package
run: poetry install --all-extras
- name: Generate buf
run: make buf
env:
BUF_TOKEN: ${{ secrets.BUF_TOKEN }}
- name: Format
run: make format
- name: Add + Commit + Open PR
shell: bash
run: |
git checkout -b workflow/update-protos || git checkout workflow/update-protos
git add --all
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 }}"
git -c pull.ff=only pull origin workflow/update-protos || true # do not fail if the branch doesn't exist
git push -f origin workflow/update-protos
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
env:
GH_TOKEN: ${{ github.token }}