Skip to content

Commit 89940fe

Browse files
v1vmergify[bot]
authored andcommitted
github-action: use ephemeral tokens with the required permissions (#14010)
(cherry picked from commit abb9a9b) # Conflicts: # .github/workflows/bump-golang.yml # .github/workflows/update-compose.yml
1 parent 170f9da commit 89940fe

File tree

4 files changed

+63
-5
lines changed

4 files changed

+63
-5
lines changed

.github/workflows/bump-elastic-stack.yml

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,12 +30,24 @@ jobs:
3030
with:
3131
ref: ${{ matrix.branch }}
3232

33+
- name: Get token
34+
id: get_token
35+
uses: tibdex/github-app-token@3beb63f4bd073e61482598c45c71c1019b59b73a # v2.1.0
36+
with:
37+
app_id: ${{ secrets.OBS_AUTOMATION_APP_ID }}
38+
private_key: ${{ secrets.OBS_AUTOMATION_APP_PEM }}
39+
permissions: >-
40+
{
41+
"contents": "write",
42+
"pull_requests": "write"
43+
}
44+
3345
- uses: elastic/oblt-actions/updatecli/run@v1
3446
with:
3547
command: --experimental apply --config .ci/updatecli/bump-elastic-stack-snapshot.yml --values .ci/updatecli/values.d/scm.yml
3648
env:
3749
BRANCH: ${{ matrix.branch }}
38-
GITHUB_TOKEN: ${{ secrets.UPDATECLI_GH_TOKEN }}
50+
GITHUB_TOKEN: ${{ steps.get_token.outputs.token }}
3951

4052
- if: ${{ failure() }}
4153
uses: elastic/oblt-actions/slack/send@v1

.github/workflows/bump-golang.yml

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,11 +16,29 @@ jobs:
1616

1717
- uses: actions/checkout@v4
1818

19+
- name: Get token
20+
id: get_token
21+
uses: tibdex/github-app-token@3beb63f4bd073e61482598c45c71c1019b59b73a # v2.1.0
22+
with:
23+
app_id: ${{ secrets.OBS_AUTOMATION_APP_ID }}
24+
private_key: ${{ secrets.OBS_AUTOMATION_APP_PEM }}
25+
permissions: >-
26+
{
27+
"contents": "write",
28+
"pull_requests": "write"
29+
}
30+
1931
- uses: elastic/oblt-actions/updatecli/run@v1
2032
with:
2133
command: --experimental apply --config .ci/updatecli/bump-golang.yml --values .ci/updatecli/values.d/scm.yml
2234
env:
35+
<<<<<<< HEAD
2336
GITHUB_TOKEN: ${{ secrets.UPDATECLI_GH_TOKEN }}
37+
=======
38+
GITHUB_TOKEN: ${{ steps.get_token.outputs.token }}
39+
GITHUB_BRANCH: 'main'
40+
GITHUB_LABELS: ${{ needs.labels.outputs.backports }}
41+
>>>>>>> abb9a9b09 (github-action: use ephemeral tokens with the required permissions (#14010))
2442

2543
bump-7:
2644
runs-on: ubuntu-latest
@@ -33,7 +51,7 @@ jobs:
3351
with:
3452
command: --experimental apply --config .ci/updatecli/bump-golang.yml --values .ci/updatecli/values.d/scm.yml
3553
env:
36-
GITHUB_TOKEN: ${{ secrets.UPDATECLI_GH_TOKEN }}
54+
GITHUB_TOKEN: ${{ steps.get_token.outputs.token }}
3755
GITHUB_BRANCH: '7.17'
3856
GITHUB_LABELS: 'backport-skip'
3957

.github/workflows/update-beats.yml

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,18 @@ jobs:
2929
with:
3030
ref: ${{ matrix.branch }}
3131

32+
- name: Get token
33+
id: get_token
34+
uses: tibdex/github-app-token@3beb63f4bd073e61482598c45c71c1019b59b73a # v2.1.0
35+
with:
36+
app_id: ${{ secrets.OBS_AUTOMATION_APP_ID }}
37+
private_key: ${{ secrets.OBS_AUTOMATION_APP_PEM }}
38+
permissions: >-
39+
{
40+
"contents": "write",
41+
"pull_requests": "write"
42+
}
43+
3244
- uses: actions/setup-go@v5
3345
with:
3446
go-version-file: go.mod
@@ -38,7 +50,7 @@ jobs:
3850
command: --experimental apply --config .ci/updatecli/update-beats.yml --values .ci/updatecli/values.d/scm.yml
3951
env:
4052
BRANCH_NAME: ${{ matrix.branch }}
41-
GITHUB_TOKEN: ${{ secrets.UPDATECLI_GH_TOKEN }}
53+
GITHUB_TOKEN: ${{ steps.get_token.outputs.token }}
4254

4355
- if: ${{ failure() }}
4456
uses: elastic/oblt-actions/slack/send@v1

.github/workflows/update-compose.yml

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,23 @@ jobs:
1818
steps:
1919
- uses: actions/checkout@v4
2020

21+
<<<<<<< HEAD
2122
- uses: docker/login-action@0d4c9c5ea7693da7b068278f7b52bda2a190a446 # v3.2.0
23+
=======
24+
- name: Get token
25+
id: get_token
26+
uses: tibdex/github-app-token@3beb63f4bd073e61482598c45c71c1019b59b73a # v2.1.0
27+
with:
28+
app_id: ${{ secrets.OBS_AUTOMATION_APP_ID }}
29+
private_key: ${{ secrets.OBS_AUTOMATION_APP_PEM }}
30+
permissions: >-
31+
{
32+
"contents": "write",
33+
"pull_requests": "write"
34+
}
35+
36+
- uses: docker/login-action@9780b0c442fbb1117ed29e0efdff1e18412f7567 # v3.3.0
37+
>>>>>>> abb9a9b09 (github-action: use ephemeral tokens with the required permissions (#14010))
2238
with:
2339
registry: ghcr.io
2440
username: ${{ github.actor }}
@@ -28,13 +44,13 @@ jobs:
2844
with:
2945
command: --experimental compose diff
3046
env:
31-
GITHUB_TOKEN: ${{ secrets.UPDATECLI_GH_TOKEN }}
47+
GITHUB_TOKEN: ${{ steps.get_token.outputs.token }}
3248

3349
- uses: elastic/oblt-actions/updatecli/run@v1
3450
with:
3551
command: --experimental compose apply
3652
env:
37-
GITHUB_TOKEN: ${{ secrets.UPDATECLI_GH_TOKEN }}
53+
GITHUB_TOKEN: ${{ steps.get_token.outputs.token }}
3854

3955
- if: ${{ failure() }}
4056
uses: elastic/oblt-actions/slack/send@v1

0 commit comments

Comments
 (0)