protos-updated #559
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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/buf-setup-action@v1 | |
with: | |
github_token: ${{ secrets.GITHUB_TOKEN }} | |
- uses: arduino/setup-protoc@v3 | |
with: | |
repo-token: ${{ secrets.GITHUB_TOKEN }} | |
version: "28.2" | |
- name: Install uv | |
uses: astral-sh/setup-uv@v3 | |
with: | |
enable-cache: true | |
- name: Setup Python | |
run: uv python install | |
- name: Store API version | |
run: | | |
uv run python3 etc/_update_version_metadata.py src/viam/version_metadata.py ${{ github.event.client_payload.tag }} | |
echo "Updated API version to ${{ github.event.client_payload.tag }} in src/viam/version_metadata.py" | |
- name: Generate buf | |
run: uv run make buf | |
env: | |
BUF_TOKEN: ${{ secrets.BUF_TOKEN }} | |
- name: Format | |
run: uv 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 }} |