This is an AI powered action designed to enhance code review and analyse file changes within a pull request by leveraging Gemini Nano to evaluate code quality, identify potential risks, suggest improvements, and generate tests automatically. It integrates seamlessly with your GitHub workflows to provide insightful feedback directly within your pull requests.
- A GitHub repository
- GitHub Actions enabled
- An account on Bunjy AI
- Visit Bunjy AI
- Log in with your GitHub account
- On the homepage sidebar click and navigate to "Access Tokens"
- Generate a new API Key and Base app url by clicking the generate button
- Copy your unique
API_KEY
andBASE_APP_URL
In your GitHub repository:
- Go to "Settings"
- Select "Secrets and variables"
- Click "New repository secret"
- Add the two secrets:
- Name:
BASE_APP_URL
- Value: Your unique base URL from Bunjy AI
- Name:
API_KEY
- Value: Your generated API key
- Name:
- NOTE: The action DOES NOT needs a personal TOKEN from github, if not provided it defaults to the one provided by github actions automatically.
I will soon find a way to use the action without the BASE_APP_URL
specified, making it more flexible and easier to configure.
Create a .github/workflows/ai.yml
file in your repository, use this template to set up:
name: AI Code Review
on:
pull_request:
branches:
'*'
jobs:
ai:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Bunjy AI Code Review
uses: mohswell/mintify@v2.1
with:
BASE_APP_URL: ${{ secrets.BASE_APP_URL }}
API_KEY: ${{ secrets.API_KEY }}
GENERATE_TESTS: 'true' # Optional: defaults to 'false' if not provided
To enable automatic generation of unit tests for changed files, set the GENERATE_TESTS
input to 'true' in your workflow file:
To cover fork branches and also to disable automatic test generation, you can modify the GENERATE_TESTS
value to 'false'. use this template to set up the workflow:
name: AI Code Review
on:
pull_request_target:
types: [opened, synchronize, reopened]
jobs:
ai:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Bunjy AI Code Review
uses: mohswell/mintify@v2.1
with:
BASE_APP_URL: ${{ secrets.BASE_APP_URL }}
API_KEY: ${{ secrets.API_KEY }}
GENERATE_TESTS: 'false'
- Users setup the action in their workflows.
- The action requires a
BASE_APP_URL
andAPI_KEY
defined in your respository secrets. - You'll visit the dashboard page at Bunjy AI to generate an
API_KEY
and also copy theBASE_APP_URL
. - Users can log in using GitHub OAuth to authorize my core service.
- The application connects directly to GitHub repositories via the action workflow.
- Securely retrieves repository and pull request data.
- Encrypts the repository data and sends it to the web server for processing/decrypting and then sends it to Gemini AI.
- Displays AI reviews for your code changes directly within the PR opened, or in the dahboard homepage.
- When a pull request is opened, the app:
- Captures code changes
- Analyzes commit messages
- Processes repository context
- Runs AI models (Gemini Nano) to evaluate:
- Code quality
- Potential risks
- Improvement suggestions
- Reviewer recommendations
flowchart LR
A[GitHub PR] --> B[Core API Service]
B --> C[Gemini AI]
C --> D[Analysis Results]
D --> E[Supabase DB]
E --> F[Web Interface]
F --> G{User Feedback}
G -->|Review/Update| B
D -->|Detailed Insights| H[Reporting Tools]
H -->|Export/Share| I[External Platforms]
This application provides intelligent insights into GitHub pull requests by analyzing:
- Code changes, commit messages, and statistics.
- AI-driven suggestions for PR quality improvements.
- PR risk assessments based on AI analysis.
- Reviewer suggestions and code quality highlights.
- Insights displayed directly in GitHub Pull Requests
- Comprehensive analysis available in Bunjy AI dashboard
web
: The main user-facing Next.js application for viewing and managing pull request analyses.api
: The backend core service powered by Prisma and Nest.js for interacting with the database and integrating AI services like Gemini.workflows/scripts
: This repository includes various shell scripts to automate different tasks:
- Analyzes files in the repository to gather insights and metrics.
- Sets up the necessary environment variables required for the application.
- Sends metadata to the server for further processing and analysis.
- Processes comments in pull requests to provide feedback and suggestions.
Clone the repository and install dependencies:
git clone https://github.com/mohswell/mintify.git
cd mintify
npm install
npm install turbo --save-dev
Configure environment variables in .env
, .env.local
, or .env.template
for different environments.
DATABASE_URL=""
DIRECT_URL=""
NEXT_PUBLIC_SUPABASE_URL=""
NEXT_PUBLIC_SUPABASE_ANON_KEY=""
SUPABASE_SERVICE_ROLE_KEY=""
NEXTAUTH_URL="http://localhost:3000"
NEXTAUTH_SECRET=""
NEXT_PUBLIC_AUTH_REDIRECT_URL="http://localhost:3000"
GITHUB_CLIENT_ID=""
GITHUB_SECRET=""
NEXT_PUBLIC_API_BASE_URL="http://localhost:8000/api/v1"
GEMINI_API_KEY=""
GEMINI_PRO_MODEL="gemini-pro"
GEMINI_PRO_VISION_MODEL="gemini-pro-vision"
PORT=8000
JWT_SECRET=""
DATABASE_URL=""
Here are the key npm scripts for managing the monorepo:
Command | Description |
---|---|
turbo run build |
Builds all apps and packages. |
rubo run dev |
Starts the development servers for all apps. |
turbo run lint |
Runs ESLint across all apps and packages. |
turbo run format |
Formats code using Prettier. |
turbo run start |
Starts the whole application in production mode. |
To start the development environment for all apps and packages:
turbo run dev
To build all apps and packages for production:
turbo run build
The repository is licensed under GNU GENERAL PUBLIC LICENSE, ensuring proper attribution and restricted commercial use. See the LICENSE
file for details.
If you find this project helpful and would like to support its development, consider buying me a coffee:
Your support is greatly appreciated!
Contributions are welcome! Please fork the repo and create a pull request with your changes and tag me in to review your features.
- Enhanced AI models
- More granular code analysis
- Machine learning improvements
- Extended language support
If you have questions or suggestions, feel free to open an issue or contact me directly at Muhammad.Said.