From 77f124da328e35524b92637448ca45c101a0409a Mon Sep 17 00:00:00 2001 From: Victor Martinez Date: Tue, 8 Oct 2024 14:56:35 +0200 Subject: [PATCH] github-actions: use GH app to manage the projects (#359) --- .github/workflows/addToProject.yml | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/.github/workflows/addToProject.yml b/.github/workflows/addToProject.yml index d8ad56370..1bce68507 100644 --- a/.github/workflows/addToProject.yml +++ b/.github/workflows/addToProject.yml @@ -3,8 +3,6 @@ name: Auto Assign to Project(s) on: issues: types: [opened, edited, milestoned] -env: - MY_GITHUB_TOKEN: ${{ secrets.APM_TECH_USER_TOKEN }} permissions: contents: read @@ -14,6 +12,18 @@ jobs: runs-on: ubuntu-latest name: Assign milestoned to Project 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" + } + - name: Assign issues with milestones to project uses: elastic/assign-one-project-github-action@1.2.2 if: github.event.issue && github.event.issue.milestone @@ -21,3 +31,5 @@ jobs: project: 'https://github.com/orgs/elastic/projects/454' project_id: '5882982' column_name: 'Planned' + env: + MY_GITHUB_TOKEN: ${{ steps.get_token.outputs.token }}