Update Upstream #114
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 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 | |
cache-dependency-path: "**/go.sum" | |
- run: go run build update | |
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 }} |