Skip to content

Commit 1ba12a0

Browse files
ncarentonclaude
andcommitted
ci: replace the add-to-project PAT with a GitHub App token (#376)
GITHUB_TOKEN cannot write to an organization project. Instead of a personal access token, create a short-lived GitHub App installation token, limited to organization projects. Read the project URL from the shared XTM_INTEGRATIONS_PROJECT_URL organization variable instead of the per-repository PROJECT_URL. Pin add-to-project to a commit SHA and drop the default GITHUB_TOKEN permissions, which the job does not use. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
1 parent 077f064 commit 1ba12a0

1 file changed

Lines changed: 18 additions & 3 deletions

File tree

‎.github/workflows/integrations-add-to-project.yml‎

Lines changed: 18 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,12 +9,27 @@ on:
99
types:
1010
- opened
1111

12+
permissions: {}
13+
1214
jobs:
1315
add-to-project:
1416
name: Add issue to project
1517
runs-on: ubuntu-latest
1618
steps:
17-
- uses: actions/add-to-project@v1.0.2
19+
# GITHUB_TOKEN has no permission on an organization project, so the token
20+
# comes from the installation of a GitHub App on the project's
21+
# organization. The issue or pull request is public, so the token needs no
22+
# permission on this repository to read it.
23+
- name: Generate GitHub App token
24+
id: app-token
25+
uses: actions/create-github-app-token@bcd2ba49218906704ab6c1aa796996da409d3eb1 # v3.2.0
26+
with:
27+
app-id: ${{ vars.ADD_TO_PROJECT_APP_ID }}
28+
private-key: ${{ secrets.ADD_TO_PROJECT_APP_PRIVATE_KEY }}
29+
owner: FiligranHQ
30+
permission-organization-projects: write
31+
32+
- uses: actions/add-to-project@244f685bbc3b7adfa8466e08b698b5577571133e # v1.0.2
1833
with:
19-
project-url: ${{ vars.PROJECT_URL }}
20-
github-token: ${{ secrets.ADD_TO_PROJECT_PAT }}
34+
project-url: ${{ vars.XTM_INTEGRATIONS_PROJECT_URL }}
35+
github-token: ${{ steps.app-token.outputs.token }}

0 commit comments

Comments
 (0)