Skip to content

gemini ai incremental code review on pushes to main branch and pull requests with previous feedback reevaluation

License

Notifications You must be signed in to change notification settings

daoch4n/zen-ai-qa-bot-gemini

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

86 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

👁️‍🗨️ zen-ai-qa[bot] 👀

Run AI Code Review on pushes to main branch and Pull Requests using Gemini Flash 2.5 model with previous feedback reevaluation ✨

image

Features

  • Automatically runs
    on pushes to main branch and Pull Requests (creation, update , reopen)
  • Talks to you as your custom [bot]
    or as github-actions[bot] if you didn't set it up
  • Auto-commits AI-actionable JSON report as your custom [bot]
    to your repo /reviews/ folder for futher agentic processing
    or as zen-ai-qa[bot] if you didn't update the hardcoded git settings in .yml files
  • Uses JSON file in question during next run
    for better context and logical consistency
  • Batches hunks related to same files
    to optimize rate limiting
  • Makes use of Gemini 1 million tokens context window
    by attaching whole file together with changes for better context
  • Optimized diff parsing algoritm
    that works better with GitHub (maybe?)
  • Uses Structured Output mode of Gemini API
    for better parsing of AI output
  • Compares actual changes to commit titles
    on pushes to main branch only

image

Readme

  • Put .py and .yml files in .github/workflows/ folder of your repo
  • Go to AI Studio and obtain Gemini API key there
  • On the repo page where you want to run this bot
    Go to Settings -> Secrets and variables -> Actions
    • Click New repository secret
      • Name: GEMINI_API_KEY
      • Secret: the API key you just got from AI Studio in JSON format: [ key ]
  • It will automatically run on pushes to main branch and pull request creation , update and reopen
  • For pushes to main branch, detailed review feedback since last push will be auto-commited to your repo /reviews/ folder (separate from PR feedback)
  • For Pull Requests, detailed review feedback will be commented by your custom [bot] on completion
    and auto-commited to same folder (separate from main branch commits feedback)

(Optional)
If you also want it to comment as your custom bot:

  • Make your own app in Developer settings and use its installation ID and key! 🗝️
  • From repo page on Github go to Settings -> Secrets and variables -> Actions
    • Click New repository secret
      • Set ZEN_APP_INSTALLATION_ID with the installation ID
        you can find installation ID in url of app settings page (the one that displays after you install app on your account or org, not the one where you generate private key)
      • Set ZEN_APP_PRIVATE_KEY with your app private key generated in app settings
      • Replace hardcoded App ID in .py file with your own app ID

        Inspired by truongnh1992/gemini-ai-code-reviewer