Run Tabnine CLI on every GitHub pull request to automate code review, documentation, test generation, and more.
Overview
The Tabnine GitHub Action is a composite action that installs the Tabnine CLI, authenticates, and runs the agent in non-interactive mode on every pull request. The included configuration provides a comprehensive code review prompt, but you can customize the prompt to automate any task — documentation generation, test scaffolding, changelog drafting, and more.
Composite Action vs. Standalone Workflow
There are two ways to use Tabnine with GitHub Actions:
Approach
Best For
Composite Action (recommended)
Most users - minimal setup, automatic updates when you bump the action version
Standalone Workflow
Users who want full control over every step, need to customize the setup, or prefer not to depend on an external action
The Quick Setup below uses the composite action. If you prefer the standalone approach, copy GitHub/tabnine-review.yml from this repository into your project at .github/workflows/tabnine-review.yml. The standalone workflow contains all the same steps (CLI installation, authentication, cleanup, and the code review prompt) inlined directly, so you can modify any part of it.
The standalone workflow uses GitHub repository variables (vars.TABNINE_HOST, vars.TABNINE_MODEL_ID) for optional configuration instead of action inputs. Set them in Settings > Secrets and variables > Actions > Variables tab > New repository variable.
Model ID for the AI agent. Overrides the default from the admin console.
Important Notes
Full git history required. The checkout step must use fetch-depth: 0 so the agent can access the full diff between the PR branch and the base branch.
continue-on-error: true is recommended so that a review failure does not block your CI pipeline. Code review is advisory - it should not prevent merges.
Permissions
The workflow requires these GitHub token permissions:
Permission
Level
Why
contents
read
Read repository files and diff
pull-requests
write
Post review comments on the PR
How It Works
1
Install the CLI
Installs Tabnine CLI from your Tabnine host.
2
Configure authentication
Configures authentication using the TABNINE_KEY secret.
3
Clean up previous comments
Cleans up any previous Tabnine PR Bot comments (to avoid duplicates on re-runs).
4
Run the agent
Runs the agent with the configured prompt — the agent has access to the repository, the PR diff (via gh pr diff), shell commands, and the GitHub API.
The agent uses the pre-authenticated gh CLI, so no additional API tokens are needed beyond GITHUB_TOKEN.
With the included code review prompt, the agent fetches the diff, classifies risk, audits the code, and posts inline comments and a summary. You can replace or extend the prompt to perform other tasks.
Customization
Reviewing Only Specific Branches
Update the on trigger to limit which branches get reviewed:
Using a Specific Model
Pass a model_id to override the default AI model:
Self-Hosted / EMT Installations
If you run a self-hosted Tabnine instance, set the tabnine_host input:
Troubleshooting
"Error: TABNINE_KEY is required"
The TABNINE_KEY secret is not set or is empty.
Solution: Add the secret in Settings > Secrets and variables > Actions > New repository secret. The value should be the Personal Access Token from your Tabnine admin console.
"Error: Tabnine CLI installation failed"
The CLI installer could not be downloaded or executed.
Solution:
Verify the tabnine_host URL is reachable from GitHub Actions runners
If using a self-hosted runner, ensure it has internet access and Node.js 20+
Check if your corporate firewall blocks the Tabnine host
No comments appear on the PR
The action ran but no review comments were posted.
Possible causes:
The PR diff is empty or contains only low-risk changes (Tier 1 reviews may post only a summary)
The pull-requests: write permission is missing from the workflow
Check the GitHub Actions logs for errors in the "Code Review" step
Duplicate comments on re-runs
The action automatically cleans up previous Tabnine PR Bot comments before posting new ones. If duplicates appear:
Solution: Ensure the github_token has pull-requests: write permission, which is required for deleting old comments.