From cf6777ffa837ef20ad005405f17b6c4c033a0b1a Mon Sep 17 00:00:00 2001 From: Asutorufa <16442314+Asutorufa@users.noreply.github.com> Date: Thu, 13 Feb 2025 18:58:56 +0800 Subject: [PATCH] add auto updater --- .github/workflows/update.yml | 50 ++++++++++++++++++++++++++++++++++++ push.sh | 6 ++--- 2 files changed, 53 insertions(+), 3 deletions(-) create mode 100644 .github/workflows/update.yml diff --git a/.github/workflows/update.yml b/.github/workflows/update.yml new file mode 100644 index 0000000..fb9083d --- /dev/null +++ b/.github/workflows/update.yml @@ -0,0 +1,50 @@ +name: updater + +on: + # run action when a change lands in the main branch which updates go.mod or + # our license template file. Also allow manual triggering. + push: + branches: + - main + +concurrency: + group: ${{ github.workflow }}-$${{ github.head_ref || github.run_id }} + cancel-in-progress: true + +jobs: + licenses-update: + runs-on: ubuntu-latest + + steps: + - name: Check out code + uses: actions/checkout@v3 + + - name: Set up Go + uses: actions/setup-go@v3 + with: + go-version-file: go.mod + + - name: Get access token + uses: actions/create-github-app-token@v1 + id: generate-token + with: + app-id: ${{ vars.APP_ID }} + private-key: ${{ secrets.PRIVATE_KEY }} + owner: ${{ github.repository_owner }} + + - name: Run update + run: | + bash push.sh + + - name: Send pull request + uses: peter-evans/create-pull-request@v7 + with: + token: ${{ steps.generate-token.outputs.token }} + author: Kitte Updater + committer: Kitte Updater + branch: auto-update + commit-message: "auto update" + title: "auto update" + body: Triggered by ${{ github.repository }}@${{ github.sha }} + delete-branch: true + signoff: true diff --git a/push.sh b/push.sh index 9f25fff..c586fde 100755 --- a/push.sh +++ b/push.sh @@ -10,6 +10,6 @@ cd yuhaiin . ./update.sh cd .. -git add . -git commit -m "update" -git push -u origin main +# git add . +# git commit -m "update" +# git push -u origin main