-
Notifications
You must be signed in to change notification settings - Fork 0
51 lines (43 loc) · 1.42 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
47
48
49
50
51
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 }}