File tree Expand file tree Collapse file tree 1 file changed +36
-4
lines changed Expand file tree Collapse file tree 1 file changed +36
-4
lines changed Original file line number Diff line number Diff line change 4444 - name : Generate latest SDK
4545 run : npm run generate
4646
47- - uses : EndBug/add-and-commit@a94899bca583c204427a224a7af87c02f9b325d5 # v9.1.4
47+ - name : Create GitHub App token
48+ id : app-token
49+ uses : actions/create-github-app-token@67018539274d69449ef7c02e8e71183d1719ab42 # v2.1.4
4850 with :
49- add : .
50- message : " chore: generate code"
51- default_author : github_actions
51+ app-id : ${{ secrets.SUMUP_BOT_APP_ID }}
52+ private-key : ${{ secrets.SUMUP_BOT_PRIVATE_KEY }}
53+
54+ - name : Get GitHub App User ID
55+ id : get-user-id
56+ run : echo "user-id=$(gh api "/users/${{ steps.app-token.outputs.app-slug }}[bot]" --jq .id)" >> "$GITHUB_OUTPUT"
57+ env :
58+ GH_TOKEN : ${{ steps.app-token.outputs.token }}
59+
60+ - name : Configure git
61+ run : |
62+ git config --global user.name '${{ steps.app-token.outputs.app-slug }}[bot]'
63+ git config --global user.email '${{ steps.get-user-id.outputs.user-id }}+${{ steps.app-token.outputs.app-slug }}[bot]@users.noreply.github.com'
64+
65+ - name : Commit changes
66+ id : commit
67+ run : |
68+ git add .
69+ if git diff --cached --quiet; then
70+ echo "changed=false" >> "$GITHUB_OUTPUT"
71+ else
72+ git commit -m "chore: generate code"
73+ echo "changed=true" >> "$GITHUB_OUTPUT"
74+ fi
75+
76+ - name : Push changes
77+ if : steps.commit.outputs.changed == 'true'
78+ env :
79+ GH_TOKEN : ${{ steps.app-token.outputs.token }}
80+ TARGET_REPO : ${{ github.event_name == 'pull_request' && github.event.pull_request.head.repo.full_name || github.repository }}
81+ TARGET_REF : ${{ github.event_name == 'pull_request' && github.event.pull_request.head.ref || github.ref_name }}
82+ run : |
83+ git push "https://x-access-token:${GH_TOKEN}@github.com/${TARGET_REPO}.git" HEAD:${TARGET_REF}
You can’t perform that action at this time.
0 commit comments