Automate AI-powered code reviews for every Pull Request using Google’s Gemini model.
This ensures consistent, high-quality review feedback on style, correctness, performance, and best practices.
- 🚀 Auto Review — Runs automatically on PR open, update, or reopen.
- 🤖 AI Suggestions — Uses Google Gemini (
gemini-2.5-pro) for detailed review. - 📂 Diff Based — Reviews only the code changes in the PR.
- 🔄 Reusable Workflow — Centralized workflow callable from multiple repos.
- 🔑 Configurable — Supports overriding model or GitHub token if needed.
- ✅ Catch issues early without waiting for human reviewers.
- ✅ Standardize review quality across repos.
- ✅ Reduce review time for repetitive issues (formatting, common bugs, performance hints).
- ✅ Easy to integrate and maintain via a reusable workflow.
The Gemini CLI requires a Google API key.
- Visit Google AI Studio
- Click Create API Key
- Copy the key and add it to your repo’s GitHub secrets:
- Navigate to Settings → Secrets and variables → Actions
- Add a new secret:
- Name:
GEMINI_API_KEY - Value: (your API key from Google AI Studio)
- Name:
The review prompt controls how Gemini reviews your code.
By default, a general-purpose prompt is used, but you can override it in the caller workflow.
with:
review_prompt: |
🧑💻 You are an AI code reviewer. Review the provided **git diff** in pr.diff.
Focus on:
- 📂 Mentioning the file name and line number
- ⚠️ Describing the issue clearly
- ❓ Explaining why it is problematic
- 🛠 Suggesting a fix
If multiple issues exist, list them separately.---
name: PR Gemini Review 🚀
on:
pull_request:
types: [opened, synchronize, reopened]
jobs:
call-gemini-review:
name: 🤖 Run Gemini Code Review
uses: clouddrove/github-shared-workflows/.github/workflows/gemini-code-review.yml@master
with:
gemini_model: "gemini-2.5-pro" # ✨ optional, default already set
github_token: ${{ github.TOKEN }} # 🔑 optional override
review_prompt: |
🧑💻 You are an AI code reviewer. Review the provided **git diff** in pr.diff.
For each issue you find:
- 📂 Mention the file name and line number
- ⚠️ Describe the issue
- ❓ Explain why it is problematic
- 🛠 Suggest a fix
If multiple issues exist, list them separately.
secrets:
GEMINI_API_KEY: ${{ secrets.GEMINI_API_KEY }}- Default GitHub token (github.TOKEN) is used unless overridden.
- You can change the model via with.gemini_model.
- Works best on small to medium PRs — large diffs may exceed token limits.