Update update_protos.yml #658
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: | |
pull_request: | |
repository_dispatch: | |
types: | |
- protos-updated | |
jobs: | |
update-protos: | |
if: github.repository_owner == 'viamrobotics' | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
token: ${{ secrets.REPO_READ_TOKEN }} | |
- uses: bufbuild/buf-setup-action@v1 | |
with: | |
github_token: ${{ secrets.GITHUB_TOKEN }} | |
- uses: arduino/setup-protoc@v3 | |
with: | |
repo-token: ${{ secrets.GITHUB_TOKEN }} | |
version: "29.2" | |
- name: Install uv | |
uses: astral-sh/setup-uv@v3 | |
with: | |
enable-cache: true | |
- name: prune origin | |
run: git remote prune origin | |
- 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 v0.1.424 | |
echo "Updated API version to v0.1.424 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 | |
id: cpr | |
uses: peter-evans/create-pull-request@v7 | |
with: | |
commit-message: '[WORKFLOW] Updating protos from ${{ github.event.client_payload.repo_name }}, commit: ${{ github.event.client_payload.sha }}' | |
branch: 'workflow/update-proto' | |
delete-branch: true | |
base: main | |
title: Automated Protos Update | |
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 | |
assignees: njooma | |
reviewers: njooma | |
token: ${{ secrets.GIT_ACCESS_TOKEN }} | |
- name: Enable Pull Request Automerge | |
if: steps.cpr.outputs.pull-request-operation == 'created' | |
uses: peter-evans/enable-pull-request-automerge@v3 | |
with: | |
token: ${{ secrets.GIT_ACCESS_TOKEN }} | |
pull-request-number: ${{ steps.cpr.outputs.pull-request-number }} | |
merge-method: squash | |
- name: Auto approve | |
if: steps.cpr.outputs.pull-request-operation == 'created' | |
run: gh pr review --approve "${{ steps.cpr.outputs.pull-request-number }}" | |
env: | |
# (TODO ethan) hard to test for sure but it's possible this is insufficient. it's unclear | |
# to me whether an approval from `viambot` is sufficient to satisfy merge requirements. | |
# if not, then this won't work. but that's not particularly bad! it just means we'll still | |
# have to merge by hand, but then we can add `viambot` as a code owner and then automatic | |
# merging will start to work. | |
GH_TOKEN: ${{ secrets.REPO_READ_TOKEN }} | |
- name: Notify slack of failure | |
uses: slackapi/[email protected] | |
if: ${{ failure() }} | |
with: | |
payload: | | |
{ | |
"text": "Python SDK update protos job has failed", | |
"username": "Python SDK", | |
"icon_url": "https://media.tenor.com/bZMubztJxGkAAAAe/charlie-brown-walking-charlie-brown.png" | |
} | |
env: | |
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_TEAM_SDK_WEBHOOK_URL }} |