Introduction to FGPAT
To enable Kody to perform automatic Code Reviews, you need to generate a Fine-Grained Personal Access Token (FGPAT) in GitHub. This token allows Kody to securely access your repositories and perform code analysis in a controlled manner.Check Fine-Grained Access Permissions
By default, a Fine-Grained PAT may not have access to your organization’s content. Ensure access by following these steps:
- You must be the organization owner.
- Go to your organization’s settings in GitHub:
- You can use this URL replacing with your org name: https://github.com/organizations/YOUR_ORG_NAME/settings/personal-access-tokens.
- In the left sidebar, under Personal access tokens, click Settings. On the Fine-grained tokens tab, select Allow access via personal access tokens and click Save.
Generating the FGPAT (Fine-Grained Personal Access Token)
Follow these steps to set up the token correctly:- Access GitHub and go to your profile settings:
-
Navigate to
Developer Settings:- In the left sidebar, scroll down to find
Developer Settingsand click on it.
- In the left sidebar, scroll down to find
-
Go to
Personal Access Tokens:- Still in the left sidebar, under
Developer Settings, selectPersonal Access Tokens. - Then, click on Fine-grained Tokens.
- Still in the left sidebar, under
-
Generate a new token:
- Click the
Generate new tokenbutton.
- Click the
-
Set up the new token with the following specifications:
- Token Name: Choose an easily identifiable name, such as
kody_code_review. - Expiration Date: If possible, select a long expiration date, preferably at least 180 days.
- Resource Owner: Ensure the organization is set as the token owner, as the team’s repositories are under the organization.
- Repository Access: Select All repositories to allow the token access to all repositories.
- Permissions: Configure the following permissions:
- Repository:
- Commit statuses: Read permission.
- Contents: Read and write permission.
- Issues: Read permission.
- Metadata: Read permission.
- Pull requests: Read and write permission.
- Webhooks: Read and write permission.
- Organization:
- Members: Read permission.
- Token Name: Choose an easily identifiable name, such as
-
Finalize and save the token:
- After setting up the permissions, click on
Generate token. - Make sure to copy the generated token and store it securely, as you’ll need it to configure Kody.
- After setting up the permissions, click on
Adding the Token to Kody
After generating the token, paste it into Kodus:- During onboarding: on Connect your Git tool, pick the Github tab and click Connect via token.
- Later: in the sidebar, open Repositories, click Github under Connect a provider, switch to the Token tab, paste the token and click Validate and save.
- Replacing a token: on Repositories, click Reset on the Github card, choose Just reset the integration, then connect again with the new token as described above.
GitHub Enterprise Server (Beta)
To connect GitHub Enterprise Server with a token, your Cloud workspace needs access to this beta. On self-hosted Kodus, setBETA_FEATURES=true.
- Create the token on your GitHub Enterprise Server instance.
- In the Github token dialog, turn on Self-hosted and enter your GitHub Enterprise URL, for example
https://github.your-company.com. It must start withhttp://orhttps://. - Paste the token and click Validate and save.
<GitHub Enterprise URL>/api/v3. If the token or the URL is wrong, the dialog says Invalid Token or GitHub Enterprise URL.