Skip to content

Commit b87eaa1

Browse files
committed
Fetch token from GitHub App
1 parent 56c2135 commit b87eaa1

File tree

1 file changed

+14
-4
lines changed

1 file changed

+14
-4
lines changed

.github/workflows/release.yml

+14-4
Original file line numberDiff line numberDiff line change
@@ -10,29 +10,39 @@ on:
1010
type: "string"
1111

1212
env:
13-
GH_TOKEN: ${{ github.token }}
1413
# TODO: Adding the mongodb-dbx-release-automation app to the repository will allow fetching a one-time token and pushing
1514
# changes on behalf of the app. This also allows bypassing branch protection rules
16-
# When the app was added, these values can be changed to use the app's data
17-
GIT_AUTHOR_NAME: "DBX Java Release Bot"
18-
GIT_AUTHOR_EMAIL: "[email protected]"
15+
GIT_AUTHOR_NAME: "mongodb-dbx-release-bot[bot]"
16+
GIT_AUTHOR_EMAIL: "167856002+mongodb-dbx-release-bot[bot]@users.noreply.github.com"
1917

2018
jobs:
2119
prepare-release:
2220
name: "Prepare release"
2321
runs-on: ubuntu-latest
2422
permissions:
23+
# Write permission for id-token is necessary to generate a new token for the GitHub App
24+
id-token: write
2525
# Write permission for contents is to ensure we're allowed to push to the repository
2626
contents: write
2727

2828
steps:
29+
- uses: actions/create-github-app-token@v1
30+
id: app-token
31+
with:
32+
app-id: ${{ vars.APP_ID }}
33+
private-key: ${{ secrets.APP_PRIVATE_KEY }}
34+
35+
- name: "Store GitHub token in environment"
36+
run: echo "GH_TOKEN=${{ steps.app-token.outputs.token }}" >> "$GITHUB_ENV"
37+
2938
- name: "Create release output"
3039
run: echo '🎬 Release process for version ${{ env.RELEASE_VERSION }} started by @${{ github.triggering_actor }}' >> $GITHUB_STEP_SUMMARY
3140

3241
- uses: actions/checkout@v4
3342
with:
3443
# fetch-depth 0 is required to fetch all branches and tags
3544
fetch-depth: 0
45+
token: ${{ steps.app-token.outputs.token }}
3646

3747
- name: "Store version numbers in env variables"
3848
# The awk command to increase the version number was copied from

0 commit comments

Comments
 (0)