Skip to content

protos-updated

protos-updated #288

Workflow file for this run

name: Update Protos + Open PR
on:
workflow_dispatch:
inputs:
api_version:
description: "The API version, including the `v`"
type: string
required: true
repository_dispatch:
types:
- protos-updated
jobs:
update-protos:
if: github.repository_owner == 'viamrobotics'
runs-on: ubuntu-latest
env:
API_VERSION: ${{ inputs.api_version || github.event.client_payload.tag }}
permissions:
id-token: write
contents: write
pull-requests: write
steps:
- uses: actions/checkout@v6
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 }}
- name: Create branch
run: |
git remote prune origin
git config user.name "github-actions[bot]"
git config user.email "github-actions[bot]@users.noreply.github.com"
git checkout -b workflow/update-proto
- name: Set API Version
run: |
echo ${{ env.API_VERSION }} > api_version.lock
- name: Generate buf
run: make buf
- name: Commit generated buf files
run: |
git add -A
git diff --cached --quiet || git commit -m "[WORKFLOW] Generate buf for version ${{ env.API_VERSION }}"
- name: Push branch and open PR
env:
GH_TOKEN: ${{ secrets.GIT_ACCESS_TOKEN }}
run: |
git push --force origin workflow/update-proto
gh pr create \
--base main \
--head workflow/update-proto \
--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" \
--assignee njooma \
--reviewer njooma \
|| gh pr edit workflow/update-proto \
--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"
- name: Notify slack of failure
uses: slackapi/slack-github-action@v3
if: ${{ failure() }}
with:
payload: |
{
"text": "Java SDK update protos job has failed",
"username": "Java SDK",
"icon_url": "https://media.tenor.com/bZMubztJxGkAAAAe/charlie-brown-walking-charlie-brown.png"
}
env:
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_TEAM_SDK_WEBHOOK_URL }}