Skip to content

Commit e554860

Browse files
authored
github-actions: use ephemeral tokens (#203)
1 parent 7874aec commit e554860

File tree

1 file changed

+13
-2
lines changed

1 file changed

+13
-2
lines changed

.github/workflows/label-elastic-pull-requests.yml

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,18 +11,29 @@ jobs:
1111
safe-to-test:
1212
runs-on: ubuntu-latest
1313
steps:
14+
- name: Get token
15+
id: get_token
16+
uses: tibdex/github-app-token@3beb63f4bd073e61482598c45c71c1019b59b73a # v2.1.0
17+
with:
18+
app_id: ${{ secrets.OBS_AUTOMATION_APP_ID }}
19+
private_key: ${{ secrets.OBS_AUTOMATION_APP_PEM }}
20+
permissions: >-
21+
{
22+
"members": "read",
23+
"pull_requests": "write"
24+
}
1425
- name: Check team membership for user
1526
uses: elastic/[email protected]
1627
id: checkUserMember
1728
with:
1829
username: ${{ github.actor }}
1930
team: 'apm'
20-
GITHUB_TOKEN: ${{ secrets.APM_TECH_USER_TOKEN }}
31+
GITHUB_TOKEN: ${{ steps.get_token.outputs.token }}
2132
- name: Add safe-to-test label
2233
uses: actions/github-script@v7
2334
if: steps.checkUserMember.outputs.isTeamMember == 'true'
2435
with:
25-
github-token: ${{ secrets.APM_TECH_USER_TOKEN }}
36+
github-token: ${{ steps.get_token.outputs.token }}
2637
script: |
2738
github.rest.issues.addLabels({
2839
issue_number: context.issue.number,

0 commit comments

Comments
 (0)