From 2ef32d025bb5613adfda3d1ba572b5699cae548c Mon Sep 17 00:00:00 2001 From: Victor Martinez Date: Tue, 8 Oct 2024 18:45:46 +0200 Subject: [PATCH] github-actions: use ephemeral tokens (#14303) --- .github/workflows/add-to-docs-project.yml | 13 ++++++++++++- .github/workflows/add-to-project.yml | 13 ++++++++++++- 2 files changed, 24 insertions(+), 2 deletions(-) diff --git a/.github/workflows/add-to-docs-project.yml b/.github/workflows/add-to-docs-project.yml index 85125dc1bc3..57de59076a1 100644 --- a/.github/workflows/add-to-docs-project.yml +++ b/.github/workflows/add-to-docs-project.yml @@ -11,6 +11,17 @@ jobs: runs-on: ubuntu-latest if: github.event.label.name == 'Team:Docs' steps: + - 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: >- + { + "organization_projects": "write", + "issues": "read" + } - uses: octokit/graphql-action@v2.x id: add_to_project with: @@ -28,4 +39,4 @@ jobs: contentid: ${{ github.event.issue.node_id }} env: PROJECT_ID: "PVT_kwDOAGc3Zs0iZw" - GITHUB_TOKEN: ${{ secrets.APM_TECH_USER_TOKEN }} + GITHUB_TOKEN: ${{ steps.get_token.outputs.token }} diff --git a/.github/workflows/add-to-project.yml b/.github/workflows/add-to-project.yml index fcd299bd85e..c89595bd3a0 100644 --- a/.github/workflows/add-to-project.yml +++ b/.github/workflows/add-to-project.yml @@ -14,7 +14,18 @@ jobs: name: Add issue to project runs-on: ubuntu-latest steps: + - 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: >- + { + "organization_projects": "write", + "issues": "read" + } - uses: actions/add-to-project@v1.0.2 with: project-url: https://github.com/orgs/elastic/projects/1286 - github-token: ${{ secrets.APM_TECH_USER_TOKEN }} \ No newline at end of file + github-token: ${{ steps.get_token.outputs.token }}