Update protos #84
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 | |
on: | |
workflow_dispatch: | |
schedule: | |
- cron: '0 0 * * 1' | |
jobs: | |
update-protos: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- name: Setup Buf | |
uses: bufbuild/buf-setup-action@v1.15.0 | |
with: | |
github_token: ${{ github.token }} | |
- name: Update | |
run: | | |
./update_protos.sh | |
- name: Setup Git | |
run: | | |
git config --global user.email "automated@example.com" | |
git config --global user.name "Automated" | |
- name: Check if Scheduled Branch Exists | |
id: check_branch | |
run: | | |
if git ls-remote --heads origin scheduled; then | |
echo "::set-output name=exists::true" | |
else | |
echo "::set-output name=exists::false" | |
fi | |
- name: Delete the Old Scheduled Branch (If Exists) | |
if: steps.check_branch.outputs.exists == 'true' | |
run: git push origin --delete scheduled | |
- name: Create New Scheduled Branch | |
run: | | |
git checkout -b scheduled | |
git add . | |
git commit -m "Scheduled Update" || echo "No changes to commit" | |
git push -f origin scheduled | |
- name: Create pull request | |
run: gh pr create -B master -H scheduled --title "Scheduled Update" --body "Update protos" | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |