From 9ca226ca508d8cfeb20a309b8bcca70bc7874563 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=B2=99=E6=BC=A0=E4=B9=8B=E5=AD=90?= <7850715+maboloshi@users.noreply.github.com> Date: Sat, 10 Feb 2024 01:31:23 +0800 Subject: [PATCH] =?UTF-8?q?GA=EF=BC=9A=E4=BD=BF=E7=94=A8`GitHub=20App`?= =?UTF-8?q?=E7=94=9F=E6=88=90=E7=9A=84=E4=B8=B4=E6=97=B6=E8=AE=BF=E9=97=AE?= =?UTF-8?q?=E4=BB=A4=E7=89=8C=E4=BB=A3=E6=9B=BF`fine-grained=20PAT`=20?= =?UTF-8?q?=E8=AF=A6=E8=A7=81:=20#74?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/locals(greasyfork).js_update.yaml | 12 ++++++++++-- .github/workflows/main.user.js_version_update.yaml | 12 ++++++++++-- .github/workflows/update_contributors_images.yml | 12 ++++++++++-- 3 files changed, 30 insertions(+), 6 deletions(-) diff --git a/.github/workflows/locals(greasyfork).js_update.yaml b/.github/workflows/locals(greasyfork).js_update.yaml index 076a35d68..e2a9605ae 100644 --- a/.github/workflows/locals(greasyfork).js_update.yaml +++ b/.github/workflows/locals(greasyfork).js_update.yaml @@ -7,7 +7,15 @@ on: jobs: update_version: runs-on: ubuntu-latest + environment: github-pages steps: + - name: Generate a token + id: generate_token + uses: actions/create-github-app-token@v1 + with: + app-id: ${{ vars.APP_ID }} + private-key: ${{ secrets.APP_PRIVATE_KEY }} + - name: Checkout repository uses: actions/checkout@v4 with: @@ -36,10 +44,10 @@ jobs: env.MAIN_USER_JS_IS_CHANGED == 'true' }} run: | bash script/ci_commit_with_signature.sh \ - -T "${{ secrets.CI_GITHUB_TOKEN }}" \ + -T "${{ steps.generate_token.outputs.token }}" \ -R "${{ github.repository }}" \ -B "${{ github.ref_name }}" \ -P "${{ github.sha }}" \ -F "locals(greasyfork).js, main(greasyfork).user.js" \ -h "main(greasyfork).user.js Update on $(TZ='Asia/Shanghai' date +'%Y-%m-%d')" \ - -b "Signed-off-by: 沙漠之子 <7850715+maboloshi@users.noreply.github.com>" + -b "Signed-off-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>" diff --git a/.github/workflows/main.user.js_version_update.yaml b/.github/workflows/main.user.js_version_update.yaml index 251d2d66e..f25729691 100644 --- a/.github/workflows/main.user.js_version_update.yaml +++ b/.github/workflows/main.user.js_version_update.yaml @@ -8,7 +8,15 @@ on: jobs: update_version: runs-on: ubuntu-latest + environment: github-pages steps: + - name: Generate a token + id: generate_token + uses: actions/create-github-app-token@v1 + with: + app-id: ${{ vars.APP_ID }} + private-key: ${{ secrets.APP_PRIVATE_KEY }} + - name: Checkout repository uses: actions/checkout@v4 with: @@ -50,10 +58,10 @@ jobs: env.MAIN_USER_JS_IS_CHANGED == 'true' }} run: | bash script/ci_commit_with_signature.sh \ - -T "${{ secrets.CI_GITHUB_TOKEN }}" \ + -T "${{ steps.generate_token.outputs.token }}" \ -R "${{ github.repository }}" \ -B "${{ github.ref_name }}" \ -P "${{ github.sha }}" \ -F "main.user.js" \ -h "main.user.js Update to version $(TZ='Asia/Shanghai' date +'%Y-%m-%d')" \ - -b "Signed-off-by: 沙漠之子 <7850715+maboloshi@users.noreply.github.com>" + -b "Signed-off-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>" diff --git a/.github/workflows/update_contributors_images.yml b/.github/workflows/update_contributors_images.yml index 0fcece5e3..5a39f50b3 100644 --- a/.github/workflows/update_contributors_images.yml +++ b/.github/workflows/update_contributors_images.yml @@ -5,7 +5,15 @@ on: jobs: build-deploy: runs-on: ubuntu-latest + environment: github-pages steps: + - name: Generate a token + id: generate_token + uses: actions/create-github-app-token@v1 + with: + app-id: ${{ vars.APP_ID }} + private-key: ${{ secrets.APP_PRIVATE_KEY }} + - name: Checkout repository uses: actions/checkout@v4 @@ -28,10 +36,10 @@ jobs: if: ${{ env.CHANGES_DETECTED == 'true' }} run: | bash script/ci_commit_with_signature.sh \ - -T "${{ secrets.CI_GITHUB_TOKEN }}" \ + -T "${{ steps.generate_token.outputs.token }}" \ -R "${{ github.repository }}" \ -B "${{ github.ref_name }}" \ -P "${{ github.sha }}" \ -F "README.md" \ -h "修改文档: 更新\`贡献者列表\`" \ - -b "Signed-off-by: 沙漠之子 <7850715+maboloshi@users.noreply.github.com>" + -b "Signed-off-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>"