Skip to content
This repository was archived by the owner on Mar 23, 2026. It is now read-only.

Commit 4693c14

Browse files
Add Github App Authentification Support
Co-Authored-by: Ryan Spletzer <ryan.spletzer@autodesk.com>
1 parent ca4a40a commit 4693c14

4 files changed

Lines changed: 4044 additions & 4 deletions

File tree

README.md

Lines changed: 22 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -40,10 +40,14 @@ jobs:
4040
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'
4141
uses: contributor-assistant/github-action@v2.6.1
4242
env:
43-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
43+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
4444
# the below token should have repo scope and must be manually added by you in the repository's secret
4545
# This token is required only if you have configured to store the signatures in a remote repository/organization
4646
# PERSONAL_ACCESS_TOKEN: ${{ secrets.PERSONAL_ACCESS_TOKEN }}
47+
# Or you could look into a github app
48+
# GITHUB_APP_ID: ${{ secrets.GITHUB_APP_ID }}
49+
# GITHUB_APP_PRIVATE_KEY: ${{ secrets.GITHUB_APP_PRIVATE_KEY }}
50+
# GITHUB_APP_INSTALLATION_ID: ${{ secrets.GITHUB_APP_INSTALLATION_ID }}
4751
with:
4852
path-to-signatures: 'signatures/version1/cla.json'
4953
path-to-document: 'https://github.com/cla-assistant/github-action/blob/master/SAPCLA.md' # e.g. a CLA or a DCO document
@@ -105,22 +109,37 @@ If a GitHub username is included in the allowlist, they will not be required to
105109

106110
![allowlist](https://github.com/cla-assistant/github-action/blob/master/images/allowlist.gif?raw=true)
107111

108-
#### 6. Adding Personal Access Token as a Secret
112+
#### 6. Option A. Adding Personal Access Token as a Secret
109113

110114
You have to create a [Repository Secret](https://docs.github.com/en/actions/security-guides/encrypted-secrets#creating-encrypted-secrets-for-a-repository) with the name `PERSONAL_ACCESS_TOKEN`.
111115
This PAT should have repo scope and is only required if you have configured to store the signatures in a remote repository/organization.
112116

113-
##### Demo for step 6
117+
##### Demo for step 6 using PAT Setup
114118

115119
![personal-access-token](https://github.com/cla-assistant/github-action/blob/master/images/personal-access-token.gif?raw=true)
116120

121+
#### 6. Option B. Adding App to use as a Secret
122+
123+
As an alternative to using a Personal Access Token, you can use GitHub App authentication which provides better security and more granular permissions. To use GitHub App authentication, you need to:
124+
125+
1. [Create a GitHub App](https://docs.github.com/en/developers/apps/creating-a-github-app) with repository contents and pull request permissions
126+
2. Generate a private key for your GitHub App
127+
3. Install the GitHub App on your organization or repository and note the installation ID
128+
4. Add the following Repository Secrets:
129+
- `GITHUB_APP_ID`: Your GitHub App's ID
130+
- `GITHUB_APP_PRIVATE_KEY`: The private key of your GitHub App (including the `-----BEGIN RSA PRIVATE KEY-----` and `-----END RSA PRIVATE KEY-----` lines)
131+
- `GITHUB_APP_INSTALLATION_ID`: The installation ID of your GitHub App
132+
117133
### Environmental Variables:
118134

119135

120136
| Name | Requirement | Description |
121137
| --------------------- | ----------- | ----------- |
122138
| `GITHUB_TOKEN` | _required_ | Usage: `GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}`, CLA Action uses this in-built GitHub token to make the API calls for interacting with GitHub. It is built into Github Actions and does not need to be manually specified in your secrets store. [More Info](https://help.github.com/en/actions/configuring-and-managing-workflows/authenticating-with-the-github_token)|
123139
| `PERSONAL_ACCESS_TOKEN` | _required_ | Usage: `PERSONAL_ACCESS_TOKEN : ${{ secrets.PERSONAL_ACCESS_TOKEN}}`, you have to create a [Personal Access Token](https://docs.github.com/en/github/authenticating-to-github/creating-a-personal-access-token) with `repo scope` and store in the repository's [secrets](https://docs.github.com/en/actions/configuring-and-managing-workflows/creating-and-storing-encrypted-secrets). |
140+
| `GITHUB_APP_ID` | _optional_ | Usage: `GITHUB_APP_ID: ${{ secrets.GITHUB_APP_ID }}`, the ID of your GitHub App. Required only if you're using GitHub App authentication and not PAT authentication. |
141+
| `GITHUB_APP_PRIVATE_KEY` | _optional_ | Usage: `GITHUB_APP_PRIVATE_KEY: ${{ secrets.GITHUB_APP_PRIVATE_KEY }}`, the private key of your GitHub App. Required only if you're using GitHub App authentication and not PAT authentication. |
142+
| `GITHUB_APP_INSTALLATION_ID` | _optional_ | Usage: `GITHUB_APP_INSTALLATION_ID: ${{ secrets.GITHUB_APP_INSTALLATION_ID }}`, the installation ID of your GitHub App. Required only if you're using GitHub App authentication and not PAT authentication. |
124143

125144
### Inputs Description:
126145

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525
"dependencies": {
2626
"@actions/core": "^1.10.0",
2727
"@actions/github": "^4.0.0",
28+
"@octokit/auth-app": "^8.2.0",
2829
"@octokit/rest": "^16.43.2",
2930
"actions-toolkit": "^2.1.0",
3031
"husky": "^4.3.8",

0 commit comments

Comments
 (0)