Skip to content

Commit 1d088b5

Browse files
committed
ci(github-actions): use create-github-app-token to generate semantic release token
1 parent 09d919a commit 1d088b5

File tree

1 file changed

+15
-1
lines changed

1 file changed

+15
-1
lines changed

.github/workflows/release.yml

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,10 +19,24 @@ jobs:
1919
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
2020
with:
2121
persist-credentials: false
22+
- name: Create GitHub App Token
23+
id: create-app-token
24+
uses: actions/create-github-app-token@v1
25+
with:
26+
app-id: ${{ secrets.APP_ID }}
27+
private-key: ${{ secrets.APP_PRIVATE_KEY }}
28+
- name: Get GitHub App User ID
29+
id: get-user-id
30+
run: echo "user-id=$(gh api "/users/${{ steps.create-app-token.outputs.app-slug }}[bot]" --jq .id)" >> "$GITHUB_OUTPUT"
31+
env:
32+
GH_TOKEN: ${{ steps.create-app-token.outputs.token }}
33+
- run: |
34+
git config --global user.name '${{ steps.app-token.outputs.app-slug }}[bot]'
35+
git config --global user.email '${{ steps.get-user-id.outputs.user-id }}+${{ steps.app-token.outputs.app-slug }}[bot]@users.noreply.github.com>'
2236
- name: Semantic Release
2337
uses: cycjimmy/semantic-release-action@cb425203a562475bca039ba4dbf90c7f9ac790f4 # v4.1.0
2438
env:
25-
GITHUB_TOKEN: ${{ secrets.TOKEN_SEMANTIC_RELEASE }}
39+
GITHUB_TOKEN: ${{ steps.create-app-token.outputs.token }}
2640
with:
2741
semantic_version: 24.1.1
2842
extra_plugins: |

0 commit comments

Comments
 (0)