Sign inSign up

shubhamstr/gemini-pr-reviewer

By shubhamstr

•Updated 4 months ago

Automated pull request analysis and review comments powered by Google Gemini AI.

Image
Security
0

1.7K

shubhamstr/gemini-pr-reviewer repository overview

⁠Gemini AI PR Reviewer

An AI-powered Pull Request reviewer for Bitbucket powered by Google Gemini. The pipe automatically analyzes pull request changes and posts review comments with suggestions related to code quality, maintainability, security, performance, and best practices.


⁠Features

  • 🤖 AI-powered automated code reviews
  • 📝 Inline pull request comments
  • 🔍 Detects code quality issues and code smells
  • 🛡️ Identifies potential security concerns
  • ⚡ Suggests performance improvements
  • 📚 Recommends coding best practices
  • 🔄 Seamless Bitbucket Pipelines integration
  • 🐳 Distributed as a Docker image / Bitbucket Pipe

⁠Prerequisites

Before using this pipe, ensure you have:

  • A Bitbucket Cloud repository
  • Bitbucket Pipelines enabled
  • A Google Gemini API Key
  • An Atlassian API Token with:
    • Repositories (Read)
    • Pull Requests (Read)
    • Pull Requests (Write)

⁠Setup

⁠1. Configure Repository Variables

In the target repository:

Repository Settings → Pipelines → Repository Variables

Create the following variables:

VariableSecureDescription
GEMINI_API_KEY✅ YesGoogle Gemini API Key
BITBUCKET_EMAIL❌ NoAtlassian account email address
BITBUCKET_TOKEN✅ YesAtlassian API Token

⁠2. Enable Bitbucket Pipelines

Navigate to:

Repository Settings → Pipelines

Enable Pipelines for the repository.


⁠3. Configure bitbucket-pipelines.yml

Add the following configuration to trigger AI reviews for all pull requests:

pipelines:
  pull-requests:
    "**":
      - step:
          name: Run AI Code Review
          script:
            - pipe: docker://shubhamstr/gemini-pr-reviewer:v1.0.0
              variables:
                GEMINI_API_KEY: $GEMINI_API_KEY
                BITBUCKET_EMAIL: $BITBUCKET_EMAIL
                BITBUCKET_TOKEN: $BITBUCKET_TOKEN

Replace:

  • v1.0.0 with the desired image version

⁠Optional Configuration

The following variables can be used to customize Gemini behavior:

VariableDescriptionDefault
GEMINI_MODELGemini model to usegemini-2.5-flash
GEMINI_MAX_TOKENSMaximum response tokens8192
GEMINI_TEMPERATUREResponse creativity level0.7
GEMINI_MAX_RETRIESRetry attempts for Gemini API calls3
GEMINI_FALLBACK_MODELSComma-separated fallback modelsNone
MAX_DIFF_CHARSMaximum diff size processed120000
REVIEW_PROMPTCustom promptYou are a senior software engineer. Review the following code...

Example:

pipelines:
  pull-requests:
    "**":
      - step:
          name: Run AI Code Review
          script:
            - pipe: docker://shubhamstr/gemini-pr-reviewer:v1.0.0
              variables:
                GEMINI_API_KEY: $GEMINI_API_KEY
                BITBUCKET_EMAIL: $BITBUCKET_EMAIL
                BITBUCKET_TOKEN: $BITBUCKET_TOKEN
                GEMINI_MODEL: "gemini-2.5-flash"
                GEMINI_MAX_TOKENS: "8192"
                GEMINI_TEMPERATURE: "0.7"
                GEMINI_MAX_RETRIES: "3"
                GEMINI_FALLBACK_MODELS: "gemini-2.5-pro,gemini-2.0-flash"
                MAX_DIFF_CHARS: "120000"
                REVIEW_PROMPT: 'You are a senior software engineer. Review the following code...'

⁠How It Works

  1. A pull request is created or updated.
  2. Bitbucket Pipelines executes the Gemini PR Reviewer pipe.
  3. The pipe retrieves the pull request diff.
  4. Google Gemini analyzes the code changes.
  5. Review comments and recommendations are posted directly to the pull request.

⁠Example Feedback

The reviewer can provide:

  • Potential bug detection
  • Security recommendations
  • Performance improvements
  • Refactoring suggestions
  • Naming and readability improvements
  • Best practice guidance
  • Maintainability feedback

⁠License

See the project repository for license details.

Tag summary

Content type

Image

Digest

sha256:f1f893bf9…

Size

48.2 MB

Last updated

4 months ago

docker pull shubhamstr/gemini-pr-reviewer:v1.0.4