Skip to content

Commit d0b2cfe

Browse files
authored
ci: use GitHub app for ephemeral tokens (#285)
1 parent d8905de commit d0b2cfe

File tree

1 file changed

+18
-6
lines changed

1 file changed

+18
-6
lines changed

.github/workflows/pre-post-release.yml

+18-6
Original file line numberDiff line numberDiff line change
@@ -51,17 +51,29 @@ jobs:
5151
runs-on: ubuntu-latest
5252
needs:
5353
- validate-tag
54-
permissions:
55-
contents: write
56-
env:
57-
GITHUB_TOKEN: ${{ secrets.RELEASE_GITHUB_TOKEN }}
5854
steps:
55+
- name: Get token
56+
id: get_token
57+
uses: tibdex/github-app-token@3beb63f4bd073e61482598c45c71c1019b59b73a # v2.1.0
58+
with:
59+
app_id: ${{ secrets.OBS_AUTOMATION_APP_ID }}
60+
private_key: ${{ secrets.OBS_AUTOMATION_APP_PEM }}
61+
permissions: >-
62+
{
63+
"contents": "write",
64+
"pull_requests": "write"
65+
}
66+
repositories: >-
67+
["ecs-logging-java"]
68+
5969
- uses: actions/checkout@v4
6070
with:
6171
ref: ${{ inputs.ref }}
62-
token: ${{ env.GITHUB_TOKEN }}
72+
token: ${{ steps.get_token.outputs.token }}
6373

6474
- uses: elastic/oblt-actions/git/setup@v1
75+
with:
76+
github-token: ${{ steps.get_token.outputs.token }}
6577

6678
- name: Create the release tag (post phase)
6779
if: inputs.phase == 'post'
@@ -93,4 +105,4 @@ jobs:
93105
- name: Create the ${{ inputs.phase }} release PR
94106
run: gh pr create --title="${{ inputs.pr_title }}" --base main --head ${{ env.BRANCH_NAME }} -b "${{ inputs.pr_body }}"
95107
env:
96-
GH_TOKEN: ${{ env.GITHUB_TOKEN }}
108+
GH_TOKEN: ${{ steps.get_token.outputs.token }}

0 commit comments

Comments
 (0)