Skip to content

An automated code review system powered by OpenAI that integrates with Git and WeChat for notifications.

Notifications You must be signed in to change notification settings

zeyu-chen/AI-Code-Review

Repository files navigation

OpenAI Code Review

Java Spring Boot OpenAI API WeChat GitHub Actions

An automated code review system powered by OpenAI that integrates with Git and WeChat for notifications.

Features

  • 🤖 AI-Powered Code Review - Automated code analysis using OpenAI
  • 📊 Git Integration - Analyzes git diff and commits
  • 💬 WeChat Notifications - Instant review notifications via WeChat
  • 🔄 GitHub Actions - Automated workflow integration
  • 📝 Review Logging - Stores review history in a separate repository

Tech Stack

  • Language: Java 11
  • Framework: Spring Boot 2.7.12
  • Build Tool: Maven
  • AI Integration: OpenAI
  • Version Control: JGit
  • Messaging: WeChat Template Messages
  • CI/CD: GitHub Actions

Getting Started

Prerequisites

  • Java 11+
  • Maven
  • GitHub account
  • WeChat Official Account
  • OpenAI API key

Installation

  1. Clone the repository
git clone git@github.com:Zeyu-Chen/AI-Podcast-App.git
cd AI-Code-Review
  1. Build with Maven
mvn clean install

Environment Variables

Configure the following environment variables in your GitHub repository's Settings > Secrets and Variables > Actions:

# GitHub
GITHUB_REVIEW_LOG_URI=       # Review log repository URI
GITHUB_TOKEN=                # GitHub personal access token
COMMIT_PROJECT=              # Target project name
COMMIT_BRANCH=               # Target branch name
COMMIT_AUTHOR=               # Commit author
COMMIT_MESSAGE=              # Commit message

# WeChat
WECHAT_APPID=                # WeChat Official Account AppID
WECHAT_SECRET=               # WeChat Official Account Secret
WECHAT_TOUSER=               # WeChat user OpenID
WECHAT_TEMPLATE_ID=          # Message template ID

# OpenAI
OPENAI_APIHOST=              # OpenAI API endpoint
OPENAI_APIKEYSECRET=         # OpenAI API key

Project Structure

openai-code-review/
├── openai-code-review-sdk/     # Core SDK module
│   ├── domain/                 # Domain logic
│   ├── infrastructure/         # External services
│   └── types/                  # Utility classes
├── openai-code-review-test/    # Test module
└── .github/                    # GitHub Actions workflows

Usage

The system can be used in two ways:

  1. As a GitHub Action:
name: Code Review
on: [push, pull_request]
jobs:
  review:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v2
      - name: Run Code Review
        uses: ./
        with:
          github-token: ${{ secrets.GITHUB_TOKEN }}
  1. As a Java library:
OpenAICodeReview review = new OpenAICodeReview();
review.exec();

About

An automated code review system powered by OpenAI that integrates with Git and WeChat for notifications.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages