Skip to content

Commit

Permalink
GA:使用GitHub App生成的临时访问令牌代替fine-grained PAT
Browse files Browse the repository at this point in the history
详见: #74
  • Loading branch information
maboloshi committed Feb 9, 2024
1 parent d191935 commit 9ca226c
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 6 deletions.
12 changes: 10 additions & 2 deletions .github/workflows/locals(greasyfork).js_update.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -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>"
12 changes: 10 additions & 2 deletions .github/workflows/main.user.js_version_update.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -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>"
12 changes: 10 additions & 2 deletions .github/workflows/update_contributors_images.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand All @@ -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>"

0 comments on commit 9ca226c

Please sign in to comment.