Skip to content

Commit e43c867

Browse files
authored
Setup git user in the release script (#686)
* Setup git user in the release script * refactor stuff
1 parent 4b6e1f1 commit e43c867

2 files changed

Lines changed: 19 additions & 23 deletions

File tree

.github/workflows/publish.yml

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -62,8 +62,8 @@ jobs:
6262
- name: Build
6363
run: pnpm build
6464

65-
- uses: actions/create-github-app-token@bcd2ba49218906704ab6c1aa796996da409d3eb1 # v3.2.0
66-
id: app-token
65+
- uses: ./.github/actions/setup-bot-auth
66+
id: bot-auth
6767
with:
6868
client-id: ${{ vars.APP_CLIENT_ID }}
6969
private-key: ${{ secrets.APP_PRIVATE_KEY }}
@@ -74,7 +74,8 @@ jobs:
7474
id: changesets
7575
uses: ./version
7676
with:
77-
github-token: ${{ steps.app-token.outputs.token }}
77+
github-token: ${{ steps.bot-auth.outputs.token }}
78+
setup-git-user: false
7879
script: pnpm bump
7980

8081
publish:
@@ -87,13 +88,6 @@ jobs:
8788
permissions:
8889
contents: write # to create release and have it authored by github-actions (changesets/action)
8990
steps:
90-
- uses: actions/create-github-app-token@bcd2ba49218906704ab6c1aa796996da409d3eb1 # v3.2.0
91-
id: app-token
92-
with:
93-
client-id: ${{ vars.APP_CLIENT_ID }}
94-
private-key: ${{ secrets.APP_PRIVATE_KEY }}
95-
permission-contents: write # to bypass branch and tag protection rules (release.ts)
96-
9791
- name: Check out repo
9892
uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3
9993
with:
@@ -106,8 +100,15 @@ jobs:
106100
- name: Build
107101
run: pnpm build
108102

103+
- uses: ./.github/actions/setup-bot-auth
104+
id: bot-auth
105+
with:
106+
client-id: ${{ vars.APP_CLIENT_ID }}
107+
private-key: ${{ secrets.APP_PRIVATE_KEY }}
108+
permission-contents: write # to bypass branch and tag protection rules (release.ts)
109+
109110
- name: Publish to marketplace
110111
uses: ./publish
111112
with:
112-
github-token: ${{ steps.app-token.outputs.token }}
113+
github-token: ${{ steps.bot-auth.outputs.token }}
113114
script: pnpm release

.github/workflows/release-pr.yml

Lines changed: 7 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -122,13 +122,6 @@ jobs:
122122
pull-requests: write # to comment on the pull request with the release result (changesets/action)
123123

124124
steps:
125-
- uses: actions/create-github-app-token@bcd2ba49218906704ab6c1aa796996da409d3eb1 # v3.2.0
126-
id: app-token
127-
with:
128-
client-id: ${{ vars.APP_CLIENT_ID }}
129-
private-key: ${{ secrets.APP_PRIVATE_KEY }}
130-
permission-contents: write # to push the release snapshot branch (release-pr.ts)
131-
132125
- name: Check out repo
133126
uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3
134127
with:
@@ -173,15 +166,17 @@ jobs:
173166
- name: Build
174167
run: pnpm build
175168

176-
- name: Setup Git user
177-
run: |
178-
git config --global user.name "github-actions[bot]"
179-
git config --global user.email "41898282+github-actions[bot]@users.noreply.github.com"
169+
- uses: ./.github/actions/setup-bot-auth
170+
id: bot-auth
171+
with:
172+
client-id: ${{ vars.APP_CLIENT_ID }}
173+
private-key: ${{ secrets.APP_PRIVATE_KEY }}
174+
permission-contents: write # to push the release snapshot branch (release-pr.ts)
180175

181176
- name: Release snapshot version
182177
run: pnpm release:pr
183178
env:
184-
GITHUB_TOKEN: ${{ steps.app-token.outputs.token }}
179+
GITHUB_TOKEN: ${{ steps.bot-auth.outputs.token }}
185180

186181
- name: Add success reaction
187182
run: gh api "/repos/$GH_REPO/issues/comments/$COMMENT_ID/reactions" -f content='rocket'

0 commit comments

Comments
 (0)