Skip to content

Commit 50f7378

Browse files
mergify[bot]v1v
andauthored
[7.17] ci: use ephemeral tokens instead of APM_SERVER_RELEASE_TOKEN (backport #14217) (#14218)
* ci: use ephemeral tokens (#14217) (cherry picked from commit 8e1eb29) # Conflicts: # .github/workflows/run-minor-release.yml * Apply suggestions from code review --------- Co-authored-by: Victor Martinez <[email protected]>
1 parent 83ea9e6 commit 50f7378

File tree

2 files changed

+18
-4
lines changed

2 files changed

+18
-4
lines changed

.github/workflows/run-minor-release.yml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,9 @@ permissions:
1313
contents: read
1414

1515
env:
16-
SLACK_CHANNEL: "#apm-server-test-release"
17-
16+
JOB_URL: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}
17+
SLACK_CHANNEL: "#apm-server"
18+
1819
jobs:
1920
run-minor:
2021
runs-on: ubuntu-latest

.github/workflows/run-patch-release.yml

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@ permissions:
1919
env:
2020
JOB_URL: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}
2121
SLACK_CHANNEL: "#apm-server"
22-
GH_TOKEN: ${{ secrets.APM_SERVER_RELEASE_TOKEN }}
2322

2423
jobs:
2524
prepare:
@@ -54,13 +53,25 @@ jobs:
5453
# Use the makefile in the given release branch.
5554
ref: ${{ env.RELEASE_BRANCH }}
5655

56+
- name: Get token
57+
id: get_token
58+
uses: tibdex/github-app-token@3beb63f4bd073e61482598c45c71c1019b59b73a # v2.1.0
59+
with:
60+
app_id: ${{ secrets.OBS_AUTOMATION_APP_ID }}
61+
private_key: ${{ secrets.OBS_AUTOMATION_APP_PEM }}
62+
permissions: >-
63+
{
64+
"contents": "write",
65+
"pull_requests": "write"
66+
}
67+
5768
# Required to use a service account, otherwise PRs created by
5869
# GitHub bot won't trigger any CI builds.
5970
# See https://github.com/peter-evans/create-pull-request/issues/48#issuecomment-537478081
6071
- name: Configure git user
6172
uses: elastic/oblt-actions/git/setup@v1
6273
with:
63-
github-token: ${{ env.GH_TOKEN }}
74+
github-token: ${{ steps.get_token.outputs.token }}
6475

6576
- name: Import GPG key
6677
uses: crazy-max/ghaction-import-gpg@01dd5d3ca463c7f10f7f4f7b4f177225ac661ee4 # v6.1.0
@@ -71,6 +82,8 @@ jobs:
7182
git_commit_gpgsign: true
7283

7384
- run: make patch-release
85+
env:
86+
GH_TOKEN: ${{ steps.get_token.outputs.token }}
7487

7588
- if: success()
7689
uses: elastic/oblt-actions/slack/send@v1

0 commit comments

Comments
 (0)