Automate code reviews and feedback for GitLab Merge Requests using OpenAI GPT-3/4
Get started with Code Reviewer by following the instructions in the Getting Started section
Introduction · Features · Getting Started · Usage · Author
Code Reviewer is a tool that integrates with GitLab and OpenAI GPT-3/4 to automatically review and provide feedback on Merge Requests. It validates code snippets, suggests improvements, and ensures that best practices are followed.
- Node.js 18+ and npm
- GitLab account
- OpenAI API key
- Integrates with GitLab Merge Requests
- Provides automated code review and feedback using OpenAI GPT-3/4
- Supports multiple programming languages
- Ensures adherence to best practices and coding standards
- Simplifies the code review process
To get started with Code Reviewer, follow the steps below:
- Clone the repository:
git clone https://github.com/yourusername/code-reviewer.git
cd code-reviewer
- Install dependencies:
npm install
- Create a .env file in the root folder and add the following variables:
GITLAB_TOKEN=your_gitlab_token
OPENAI_API_KEY=your_openai_api_key
Replace your_gitlab_token with your GitLab personal access token, and your_openai_api_key with your OpenAI API key.
- Build the project:
npm run build
- Start the server:
npm run start
-
In your GitLab project, create a webhook that triggers on Merge Request events.
-
Set the webhook URL to the endpoint of your Code Reviewer server (e.g., https://your-code-reviewer-server.com/webhook).
-
When a Merge Request is created or updated in your GitLab project, Code Reviewer will automatically review the code and provide feedback as comments on the Merge Request.
- Fork this repository;
- Create your branch:
git checkout -b my-awesome-contribution
; - Commit your changes:
git commit -m 'feat: Add some awesome contribution'
; - Push to the branch:
git push origin my-awesome-contribution
.
Licensed under the MIT License, Copyright © 2023
See LICENSE for more information.
- Rik Vermeulen (@rikvermeulen_)