Skip to content

Commit d08b6a8

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

File tree

1 file changed

+16
-1
lines changed

1 file changed

+16
-1
lines changed

.github/workflows/release.yml

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,14 +15,29 @@ jobs:
1515
release:
1616
runs-on: ubuntu-latest
1717
steps:
18+
- name: Create GitHub App Token
19+
id: app-token
20+
uses: actions/create-github-app-token@v1
21+
with:
22+
app-id: ${{ secrets.APP_ID }}
23+
private-key: ${{ secrets.APP_PRIVATE_KEY }}
24+
- name: Get GitHub App User ID
25+
id: get-user-id
26+
run: echo "user-id=$(gh api "/users/${{ steps.app-token.outputs.app-slug }}[bot]" --jq .id)" >> "$GITHUB_OUTPUT"
27+
env:
28+
GH_TOKEN: ${{ steps.app-token.outputs.token }}
29+
- run: |
30+
git config --global user.name '${{ steps.app-token.outputs.app-slug }}[bot]'
31+
git config --global user.email '${{ steps.get-user-id.outputs.user-id }}+${{ steps.app-token.outputs.app-slug }}[bot]@users.noreply.github.com>'
1832
- name: Checkout repository
1933
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
2034
with:
2135
persist-credentials: false
36+
token: ${{ steps.app-token.outputs.token }}
2237
- name: Semantic Release
2338
uses: cycjimmy/semantic-release-action@cb425203a562475bca039ba4dbf90c7f9ac790f4 # v4.1.0
2439
env:
25-
GITHUB_TOKEN: ${{ secrets.TOKEN_SEMANTIC_RELEASE }}
40+
GITHUB_TOKEN: ${{ steps.app-token.outputs.token }}
2641
with:
2742
semantic_version: 24.1.1
2843
extra_plugins: |

0 commit comments

Comments
 (0)