Skip to content

ci: replace the add-to-project PAT with a GitHub App token (#376) - #377

Merged
Nicolas Carenton (ncarenton) merged 2 commits into
mainfrom
ci/add-to-project-github-app
Nov 16, 2026
Merged

Nicolas Carenton (ncarenton) merged 2 commits into
mainfrom
ci/add-to-project-github-app

Conversation

@ncarenton

@ncarenton Nicolas Carenton (ncarenton) commented Nov 6, 2026 •

Copy link
Copy Markdown
Member

Proposed changes

  • Replace the ADD_TO_PROJECT_PAT personal access token with a short-lived GitHub App installation token, created by actions/create-github-app-token and limited to organization projects (permission-organization-projects: write).
  • Read the project URL from the shared XTM_INTEGRATIONS_PROJECT_URL organization variable instead of the per-repository PROJECT_URL variable.
  • Identify the App by its client ID (client-id): actions/create-github-app-token deprecates app-id.
  • Pin actions/add-to-project to a commit SHA and set permissions: {}: the job does not use GITHUB_TOKEN.

Testing Instructions

  1. The ADD_TO_PROJECT_APP_CLIENT_ID variable and the ADD_TO_PROJECT_APP_PRIVATE_KEY secret are already set on this repository.
  2. issues and pull_request_target run the workflow from the default branch, so this PR cannot test itself: after the merge, open a test issue and check that the workflow succeeds and the issue lands on the project.
  3. Then delete the ADD_TO_PROJECT_PAT secret and the PROJECT_URL variable.

Related issues

Checklist

  • I consider the submitted work as finished
  • I have signed my commits using GPG key.
  • I tested the code for its functionality (only possible after the merge, see above)

Further comments

🤖 Generated with Claude Code

@ncarenton Nicolas Carenton (ncarenton) added filigran team Item from the Filigran team. vibe-coded PR: AI-assisted change — the author reviews it before requesting others' review. labels Nov 6, 2026
Copilot AI balanced review requested due to automatic review settings November 6, 2026 11:02
@ncarenton Nicolas Carenton (ncarenton) added the vibe-coded PR: AI-assisted change — the author reviews it before requesting others' review. label Nov 6, 2026

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔵 Needs a closer look

The migration requires live post-merge validation of the GitHub App’s credentials and organization-project write access for both issues and pull requests before removing the PAT secret.

No open issues 🎉

What changed in this PR

Replaces the add-to-project workflow’s personal access token with a short-lived GitHub App installation token, addressing #376.

Changes:

  • Generates an App token scoped to organization projects write access.
  • Pins both actions to commit SHAs and disables GITHUB_TOKEN permissions.
  • Requires post-merge verification before deleting the old PAT secret.
File Description
.github/​workflows/​integrations-add-to-project.yml Generates and uses the App token, pins actions, and sets permissions: {}.

Review effort: Balanced

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>

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for your work!
These are just suggestions, nothing that would block the PR, but they also apply to your other two PRs:

OpenAEV-Platform/collectors#664
OpenAEV-Platform/injectors#493

id: app-token
uses: actions/create-github-app-token@bcd2ba49218906704ab6c1aa796996da409d3eb1 # v3.2.0
with:
app-id: ${{ vars.ADD_TO_PROJECT_APP_ID }}

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Use client-id instead of app-id

The official actions/create-github-app-token documentation now recommends using the client-id input instead of app-id to identify the GitHub App.

The legacy app-id input is also accepted, but client-id is recommended.

However, using app-id is not currently an issue, as this input is still supported for backward compatibility. Nevertheless, since we are already making changes to this GitHub Action, it might be a good opportunity to anticipate this migration and align with the current recommendations ?

I don't have access to the GitHub App configuration, so I cannot verify whether our Client ID is available. If we decide to proceed with this migration, we should also remember to add a dedicated variable environment (e.g. ADD_TO_PROJECT_APP_CLIENT_ID ?) so that it can be used in the workflows across the respective repositories.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done: the workflow now uses client-id with a new ADD_TO_PROJECT_APP_CLIENT_ID variable, and the ADD_TO_PROJECT_APP_ID variable is removed. Thanks!

app-id: ${{ vars.ADD_TO_PROJECT_APP_ID }}
private-key: ${{ secrets.ADD_TO_PROJECT_APP_PRIVATE_KEY }}
owner: FiligranHQ
permission-organization-projects: write

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Explicitly specify the required permissions

One thing caught my attention while reading the actions/create-github-app-token

By default, the token inherits all of the installation's permissions.
We recommend to explicitly list the permissions that are required for a use case.

Since I don't have access to the GitHub App configuration, I cannot verify which permissions are currently granted to its installation.

Wouldn't it be worth explicitly restricting the token's permissions, even though the source repositories are public? This would help prevent the token from inheriting unnecessary write permissions for issues and pull requests, reducing the potential impact in case the token is compromised.

My suggestion would be to follow the GitHub recommendation and explicitly add the following permissions:

permission-issues: read
permission-pull-requests: read

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I believe the access is already restricted as permission-organization-projects: write makes the token request only that permission. Adding issues/pull-requests: read would widen it.

actions/create-github-app-token deprecates the app-id input in favor of
client-id.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for these improvements; this works for me!

@ncarenton
Nicolas Carenton (ncarenton) merged commit a059adf into main Nov 16, 2026
11 of 12 checks passed
@ncarenton
Nicolas Carenton (ncarenton) deleted the ci/add-to-project-github-app branch November 16, 2026 13:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

filigran team Item from the Filigran team. vibe-coded PR: AI-assisted change — the author reviews it before requesting others' review.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

ci: replace the add-to-project PAT with a GitHub App token

3 participants