truongnh1992/gemini-ai-code-reviewer
소개
A GitHub Action that automatically reviews pull requests using Google's Gemini AI.
AI 및 머신러닝What you can do
- Review your PRs using Gemini API
- Give use comments and suggestions to improve the source codes
측정된 스타 증가
- in 24h
- 0
- in 7 days
- 0
- in 15 days
- +1
- in 1 month
- 기록 수집 중
서로 겹치는 기간의 순증가량이며 일별 합계가 아닙니다. 측정값이 없으면 비워 둡니다. 스타는 관심도를 나타내며 품질을 보장하지 않습니다.
README.md
OriginalGoogle Cloud credits are provided for this project #VertexAISprint
Thanks, Google :)
Gemini AI Code Reviewer
A GitHub Action that automatically reviews pull requests using Google's Gemini AI.
Features
- Review your PRs using Gemini API
- Give use comments and suggestions to improve the source codes
Setup
To use this GitHub Action, you need an Gemini API key. If you don't have one, sign up for an API key at Google AI Studio.
Add the Gemini API key as a GitHub Secret in your repository with the name
GEMINI_API_KEY. You can find more information about GitHub Secrets here.Create a
.github/workflows/code-review.ymlfile in your repository and add the following content:
name: Gemini AI Code Reviewer
on:
issue_comment:
types: [created]
permissions: write-all
jobs:
gemini-code-review:
runs-on: ubuntu-latest
if: |
github.event.issue.pull_request &&
contains(github.event.comment.body, '/gemini-review')
steps:
- name: PR Info
run: |
echo "Comment: ${{ github.event.comment.body }}"
echo "Issue Number: ${{ github.event.issue.number }}"
echo "Repository: ${{ github.repository }}"
- name: Checkout Repo
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Get PR Details
id: pr
run: |
PR_JSON=$(gh api repos/${{ github.repository }}/pulls/${{ github.event.issue.number }})
echo "head_sha=$(echo $PR_JSON | jq -r .head.sha)" >> $GITHUB_OUTPUT
echo "base_sha=$(echo $PR_JSON | jq -r .base.sha)" >> $GITHUB_OUTPUT
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- uses: truongnh1992/gemini-ai-code-reviewer@main
with:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GEMINI_API_KEY: ${{ secrets.GEMINI_API_KEY }}
GEMINI_MODEL: gemini-3.8-flash # Optional, default is `gemini-3.8-flash`
EXCLUDE: "*.md,*.txt,package-lock.json,*.yml,*.yaml"
if you don't set
GEMINI_MODEL, the default model isgemini-3.8-flash.gemini-3.8-flashis a next-generation model offering speed and multimodal generation capabilities. It's suitable for a wide variety of tasks, including code generation, data extraction, and text editing.. For the detailed information about the models, please refer to Gemini models.
- Commit codes to your repository, and working on your pull requests.
- When you're ready to review the PR, you can trigger the workflow by commenting
/gemini-reviewin the PR.
How It Works
This GitHub Action uses the Gemini AI API to provide code review feedback. It works by:
- Analyzing the changes: It grabs the code modifications from your pull request and filters out any files you don't want reviewed.
- Consulting the Gemini model: It sends chunks of the modified code to the Gemini for analysis.
- Providing feedback: Gemini AI examines the code and generates review comments.
- Delivering the review: The Action adds the comments directly to your pull request on GitHub.
License
This project is licensed under the MIT License. See the LICENSE file for more information.
Star History ⭐️
관련 프로젝트 살펴보기
불러오는 중…