Install/run via GitHub Actions
Seamlessly integrate automated code reviews into your GitHub Actions workflows.
Prerequisites
Bito Access Key: Obtain your Bito Access Key. View Guide
GitHub Personal Access Token (Classic): For GitHub PR code reviews, ensure you have a CLASSIC personal access token with repo access. We do not support fine-grained tokens currently. View Guide

Installation and Configuration Steps:
Enable GitHub Actions:
Login to your GitHub account.
Open your repository and click on the "Settings" tab.

Select "Actions" from the left sidebar, then click on "General".

Under "Actions permissions", choose "Allow all actions and reusable workflows" and click "Save".

Set Up Environment Variables:
Still in the "Settings" tab, navigate to "Secrets and variables" > "Actions" from the left sidebar.

Configure the following under the "Secrets" tab:
For each secret, click the New repository secret button, then enter the exact name and value of the secret in the form. Finally, click Add secret to save it.
Name:
BITO_ACCESS_KEYSecret: Enter your Bito Access Key here. Refer to the guide for obtaining your Bito Access Key.
Name:
GIT_ACCESS_TOKENSecret: Enter your GitHub Personal Access Token (Classic) with repo access. We do not support fine-grained tokens currently. For more information, see the Prerequisites section.



Configure the following under the "Variables" tab:
For each variable, click the New repository variable button, then enter the exact name and value of the variable in the form. Finally, click Add variable to save it.
Name:
STATIC_ANALYSIS_TOOLValue: Enter the following text string as value:
fb_infer,astral_ruff,mypy
Name:
GIT_DOMAINValue: Enter the domain name of your Enterprise or self-hosted GitHub deployment or skip this if you are not using Enterprise or self-hosted GitHub deployment.
Example of domain name:
https://your.company.git.com
Name:
EXCLUDE_BRANCHESValue: Specify branches to exclude from the review by name or valid glob/regex patterns. The agent will skip the pull request review if the source or target branch matches the exclusion list.
Note: For more information, see Source or Target branch filter.
Name:
EXCLUDE_FILESValue: Specify files/folders to exclude from the review by name or glob/regex pattern. The agent will skip files/folders that match the exclusion list.
Note: For more information, see Files and folders filter.
Name:
EXCLUDE_DRAFT_PRValue: Enter
Trueto disable automated review for draft pull requests, orFalseto enable it.Note: For more information, see Draft pull requests filter.



Create the Workflow Directory:
In your repository, create a new directory path:
.github/workflows.
Add the Workflow File:
Download this
test_cra.ymlfile from AI Code Review Agent's GitHub repo.
In your repository, upload this
test_cra.ymlfile inside the.github/workflowsdirectory either in your source branch of each PR or in a branch (e.g. main) from which all the source branches for PRs will be created.


Commit your changes.


Customizations for self-hosted GitHub
Create a self-hosted Runner using Linux image and x64 architecture as described in the GitHub documentation.
Create a copy of Bito's repository gitbito/codereviewagent main branch into your self-hosted GitHub organization e.g. "myorg" under the required name e.g. "gitbito-bitocodereview". In this example, now this repository will be accessible as "myorg/gitbito-bitocodereview".
Update
test_cra.ymlas below:Change line from:
runs-on: ubuntu-latest
to:
runs-on: <label of the self-hosted GitHub Runner> e.g. self-hosted, linux etc.
Update
test_cra.ymlas below:Replace all lines having below text:
uses: gitbito/codereviewagent@main
with:
uses: myorg/gitbito-bitocodereview@main
Commit and push your changes in
test_cra.yml.
Using the AI Code Review Agent
After configuring the GitHub Actions, you can invoke the AI Code Review Agent in the following ways:
Automated Code Review: The agent will automatically review new pull requests as soon as they are created and post the review feedback as a comment within your PR.
Manually Trigger Code Review: To start the process, simply type
/reviewin the comment box on the pull request and submit it. This command prompts the agent to review the pull request and post its feedback directly in the PR as a comment.Bito also offers specialized commands that are designed to provide detailed insights into specific areas of your source code, including security, performance, scalability, code structure, and optimization.
/review security: Analyzes code to identify security vulnerabilities and ensure secure coding practices./review performance: Evaluates code for performance issues, identifying slow or resource-heavy areas./review scalability: Assesses the code's ability to handle increased usage and scale effectively./review codeorg: Scans for readability and maintainability, promoting clear and efficient code organization./review codeoptimize: Identifies optimization opportunities to enhance code efficiency and reduce resource usage.
By default, the
/reviewcommand generates inline comments, meaning that code suggestions are inserted directly beneath the code diffs in each file. This approach provides a clearer view of the exact lines requiring improvement. However, if you prefer a code review in a single post rather than separate inline comments under the diffs, you can include the optional parameter:/review #inline_comment=FalseFor more details, refer to Available Commands.

Screenshots
Screenshot # 1

Screenshot # 2

Screenshot # 3

Last updated

