-
Notifications
You must be signed in to change notification settings - Fork 2
40 lines (34 loc) · 1.08 KB
/
update-upstream.yaml
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
name: "Update Upstream"
on:
schedule:
- cron: "5 4 * * *"
workflow_dispatch:
jobs:
build:
name: Update Upstream
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: actions/setup-go@v5
with:
go-version-file: go.work
- run: go run mage updateUpstream
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- run: git diff --exit-code
id: check-diff
continue-on-error: true
- name: create PR
if: steps.check-diff.outcome == 'failure'
run: |
git config --global user.name "github-actions[bot]"
git config --global user.email "github-actions[bot]@users.noreply.github.com"
git checkout -b update-upstream-${{ github.run_id }}
git add .
git commit -m "Update to latest upstream"
git push -u origin -f update-upstream-${{ github.run_id }}
gh pr create --fill --head update-upstream-${{ github.run_id }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}