From 16ab55a713d851bd4b121d2c662f32048e551aa3 Mon Sep 17 00:00:00 2001 From: Victor Martinez Date: Wed, 18 Sep 2024 16:07:45 +0200 Subject: [PATCH] github-action: use ephemeral tokens with the required permissions (#399) --- .github/workflows/updatecli.yml | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/.github/workflows/updatecli.yml b/.github/workflows/updatecli.yml index 0b068319..242dd5cf 100644 --- a/.github/workflows/updatecli.yml +++ b/.github/workflows/updatecli.yml @@ -14,11 +14,23 @@ jobs: steps: - uses: actions/checkout@v4 + - name: Get token + id: get_token + uses: tibdex/github-app-token@3beb63f4bd073e61482598c45c71c1019b59b73a # v2.1.0 + with: + app_id: ${{ secrets.OBS_AUTOMATION_APP_ID }} + private_key: ${{ secrets.OBS_AUTOMATION_APP_PEM }} + permissions: >- + { + "contents": "write", + "pull_requests": "write" + } + - uses: elastic/oblt-actions/updatecli/run@v1 with: command: "--experimental apply --config .ci/updatecli.d" env: - GITHUB_TOKEN: ${{ secrets.UPDATECLI_GH_TOKEN }} + GITHUB_TOKEN: ${{ steps.get_token.outputs.token }} - if: failure() uses: elastic/oblt-actions/slack/send@v1