Skip to content

Commit

Permalink
use PAT
Browse files Browse the repository at this point in the history
  • Loading branch information
sushichan044 committed Oct 21, 2024
1 parent 9f87e43 commit 7cf1740
Showing 1 changed file with 4 additions and 16 deletions.
20 changes: 4 additions & 16 deletions .github/workflows/update-snapshot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -133,22 +133,10 @@ jobs:
with:
ref: ${{ needs.check-target-packages.outputs.head_ref }}

- uses: actions/create-github-app-token@5d869da34e18e7287c1daad50e0b8ea0f506ce69 # v1.11.0
id: app-token
with:
app-id: ${{ vars.ACTIONS_MIKU_APP_ID }}
private-key: ${{ secrets.ACTIONS_MIKU_PRIVATE_KEY }}

- name: Get GitHub App User ID
id: get-user-id
run: echo "user-id=$(gh api "/users/${{ steps.app-token.outputs.app-slug }}[bot]" --jq .id)" >> "$GITHUB_OUTPUT"
env:
GH_TOKEN: ${{ steps.app-token.outputs.token }}

- name: Configure Git Identity
run: |
git config --global user.name '${{ steps.app-token.outputs.app-slug }}[bot]'
git config --global user.email '${{ steps.get-user-id.outputs.user-id }}+${{ steps.app-token.outputs.app-slug }}[bot]@users.noreply.github.com>'
git config --global user.name ${{ secrets.PAT_USERNAME }}
git config --global user.email ${{ secrets.PAT_EMAIL }}
if [ ${{ github.event_name }} == 'workflow_dispatch' ]; then
git switch -c "bot/update-snapshot-$(TZ=UTC-9 date +'%Y%m')-${SHA:0:7}"
Expand Down Expand Up @@ -212,7 +200,7 @@ jobs:
gh pr comment ${{ github.event.issue.number }} --body-file CHANGES.md --edit-last \
|| gh pr comment ${{ github.event.issue.number}} --body-file CHANGES.md
env:
GH_TOKEN: ${{ steps.app-token.outputs.token }}
GH_TOKEN: ${{ secrets.PAT_GITHUB_ACTIONS_TOKEN }}

- name: Create Pull Request (Workflow Dispatch)
if: github.event_name == 'workflow_dispatch'
Expand All @@ -225,4 +213,4 @@ jobs:
gh pr create --base "main" --body-file CHANGES.md --title "update snapshot (github-actions)"
env:
GH_TOKEN: ${{ steps.app-token.outputs.token }}
GH_TOKEN: ${{ secrets.PAT_GITHUB_ACTIONS_TOKEN }}

0 comments on commit 7cf1740

Please sign in to comment.