Automate GitHub Pull Requests reviews with Code Review Agent¶
This demo goes over the process of integrating and utilizing Gemini Code Assist to improve GitHub code reviews. The demo will cover essential setup procedures in both Google Cloud and GitHub, followed by a showcase of Gemini Code Assist's capabilities in delivering smart suggestions, clear explanations, and concise summaries to optimize the code review workflow.
Requirements¶
To follow this demo, you need:
- A Google Cloud project with the
Ownerrole. - GitHub account and repository
- Antigravity CLI: Installed and configured. For installation instructions, visit antigravity.google.
- GitHub CLI: Installed and configured. For installation instructions, visit Installation.
GitHub Prerequisites¶
Use existing or create a new GitHub repository to configure Gemini Code Assist on GitHub.
Below are the steps to create a new GitHub repository using gh cli from the
Cloud Shell environment.
-
Authenticate with GitHub using HTTPS option:
-
Create a new private repository:
Google Cloud Project Prerequisites¶
You need Admin or Owner basic roles for your Google Cloud project.
Setup details.
Install Gemini Code Assist application on GitHub¶
Follow instructions to install Gemini Code Assist on GitHub.
Code Review Agent Configuration¶
At this point, Code Review agent is enabled for the selected repositories.
- On the
Settingsscreen for your Developer connection, you have an option to select comment severity level and also enable memory to improve review response quality. - On the
Style Guidetab, you have an option to provide a project specific style guide. If your repository already contains a.gemini/styleguide.mdfile, the instructions from both places will be concatenated and used as an input for the Code Review Agent during the PR review process.
Prepare to create GitHub Pull Request¶
Return to the Cloud Shell terminal and clone the repository. Update the path to
~/gemini-code-review-agent folder in the commands below, if you didn't clone
it in the home folder.
-
Clone the repository:
-
Copy
menu-servicefolder: -
Change into
~/gemini-code-review-agentfolder: -
Start Antigravity CLI:
-
Commit new changes and open a pull request:
Review and approve tools that Antigravity CLI requires to complete this task.
Exit from Antigravity CLI before moving to the next section.
Pull Request Review¶
Open GitHub repository in the browser and observe the Code Review Agent providing a summary and review for the created pull request.
Invoking Gemini¶
You can request assistance from Gemini at any point by creating a PR comment in
the GitHub UI using either /gemini <command> or
@gemini-code-assist <command>.
-
Code Review - Performs a code review of the pull request:
-
Pull Request Summary - Provides a summary of the pull request:
-
Comment - Responds in comments when explicitly tagged, both in pull request comments and review comments: