From 63d441cac688f3ca879ed031483ab5764ee4b043 Mon Sep 17 00:00:00 2001 From: Kyle Carberry Date: Sun, 15 Nov 2026 20:33:53 -0500 Subject: [PATCH] ci: use the coder-cla GitHub App instead of the cdrcommunity token The CLA bot now mints a short-lived coder-cla App token (contents write on coder/cla only) instead of CDRCOMMUNITY_GITHUB_TOKEN. The job runs in the cla environment, which holds the App key and only accepts main, and gets explicit, minimal permissions. The action is pinned to the commit of v2.6.1. Co-Authored-By: Claude Opus 5.5 --- .github/workflows/cla.yaml | 29 +++++++++++++++++++++++++---- 1 file changed, 25 insertions(+), 4 deletions(-) diff --git a/.github/workflows/cla.yaml b/.github/workflows/cla.yaml index 71c2e90..110039d 100644 --- a/.github/workflows/cla.yaml +++ b/.github/workflows/cla.yaml @@ -2,20 +2,41 @@ name: "CLA Assistant" on: issue_comment: types: [created] + # zizmor: ignore[dangerous-triggers] The CLA bot needs pull_request_target and never checks out PR code. pull_request_target: types: [opened,closed,synchronize] +permissions: + contents: read + jobs: CLAssistant: runs-on: ubuntu-latest + # Holds the coder-cla App key; only main may use it. pull_request_target and + # issue_comment runs use the base branch, so only PRs into main are checked. + environment: cla + if: >- + (github.event_name == 'issue_comment' && (github.event.comment.body == 'recheck' || github.event.comment.body == 'I have read the CLA Document and I hereby sign the CLA')) || + (github.event_name == 'pull_request_target' && github.event.pull_request.base.ref == 'main') + permissions: + pull-requests: write steps: + # Writes signatures to coder/cla, which GITHUB_TOKEN can't reach. + - name: Generate coder-cla App token + id: cla_token + uses: actions/create-github-app-token@64ab729a6294000f5aa4a4bc0b73d1f32bc45510 # v3.3.0 + with: + app-id: ${{ secrets.CODER_CLA_APP_ID }} + private-key: ${{ secrets.CODER_CLA_APP_PRIVATE_KEY }} + owner: coder + repositories: cla + permission-contents: write + - name: "CLA Assistant" - if: (github.event.comment.body == 'recheck' || github.event.comment.body == 'I have read the CLA Document and I hereby sign the CLA') || github.event_name == 'pull_request_target' - uses: contributor-assistant/github-action@v2.6.1 + uses: contributor-assistant/github-action@ca4a40a7d1004f18d9960b404b97e5f30a505a08 # v2.6.1 env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - # the below token should have repo scope and must be manually added by you in the repository's secret - PERSONAL_ACCESS_TOKEN : ${{ secrets.CDRCOMMUNITY_GITHUB_TOKEN }} + PERSONAL_ACCESS_TOKEN: ${{ steps.cla_token.outputs.token }} with: remote-organization-name: 'coder' remote-repository-name: 'cla'