Skip to content

Commit 8341f3e

Browse files
authored
github-action: use ephemeral tokens with the required permissions (#278)
1 parent f9357e9 commit 8341f3e

File tree

1 file changed

+14
-2
lines changed

1 file changed

+14
-2
lines changed

.github/workflows/updatecli.yml

+14-2
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,18 @@ jobs:
1717
steps:
1818
- uses: actions/checkout@v4
1919

20+
- name: Get token
21+
id: get_token
22+
uses: tibdex/github-app-token@3beb63f4bd073e61482598c45c71c1019b59b73a # v2.1.0
23+
with:
24+
app_id: ${{ secrets.OBS_AUTOMATION_APP_ID }}
25+
private_key: ${{ secrets.OBS_AUTOMATION_APP_PEM }}
26+
permissions: >-
27+
{
28+
"contents": "write",
29+
"pull_requests": "write"
30+
}
31+
2032
- uses: docker/login-action@9780b0c442fbb1117ed29e0efdff1e18412f7567 # v3.3.0
2133
with:
2234
registry: ghcr.io
@@ -27,13 +39,13 @@ jobs:
2739
with:
2840
command: --experimental compose diff
2941
env:
30-
GITHUB_TOKEN: ${{ secrets.UPDATECLI_GH_TOKEN }}
42+
GITHUB_TOKEN: ${{ steps.get_token.outputs.token }}
3143

3244
- uses: elastic/oblt-actions/updatecli/run@v1
3345
with:
3446
command: --experimental compose apply
3547
env:
36-
GITHUB_TOKEN: ${{ secrets.UPDATECLI_GH_TOKEN }}
48+
GITHUB_TOKEN: ${{ steps.get_token.outputs.token }}
3749

3850
- if: failure()
3951
uses: elastic/oblt-actions/slack/send@v1

0 commit comments

Comments
 (0)