forked from nfacha/OpenAI-Gitlab-PR-Review
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Nuno Facha
committed
Apr 9, 2023
1 parent
20ae88d
commit 207015f
Showing
3 changed files
with
66 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
OPENAI_API_KEY=<your OpenAI API key> | ||
GITLAB_TOKEN=<your GitLab API token> | ||
GITLAB_URL=https://git.facha.dev/api/v4 | ||
EXPECTED_GITLAB_TOKEN=<your expected GitLab token> | ||
GITLAB_URL=https://gitlab.com/api/v4 | ||
EXPECTED_GITLAB_TOKEN=<your expected GitLab token> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,64 @@ | ||
# OpenAI-Gitlab-PR-Reviwer | ||
# AI Code Reviewer | ||
|
||
AI Code Reviewer is a Python script that leverages OpenAI's GPT-3.5-turbo to automatically review code changes in GitLab repositories. It listens for merge request and push events, fetches the associated code changes, and provides feedback on the changes in a Markdown format. | ||
|
||
## Features | ||
|
||
- Automatically reviews code changes in GitLab repositories | ||
- Provides feedback on code clarity, simplicity, bugs, and security issues | ||
- Generates Markdown-formatted responses for easy readability in GitLab | ||
|
||
## Getting Started | ||
|
||
### Prerequisites | ||
|
||
- Python 3.8 or higher | ||
- Docker (optional) | ||
- An OpenAI API key | ||
- A GitLab API token | ||
|
||
### Installation | ||
|
||
1. Clone the repository: | ||
``` | ||
https://git.facha.dev/facha/openai-gitlab-pr-review.git | ||
cd ai-code-reviewer | ||
``` | ||
|
||
2. Install the required Python packages: | ||
``` | ||
pip install -r requirements.txt | ||
``` | ||
|
||
3. Create a `.env` file and set the required environment variables: | ||
``` | ||
OPENAI_API_KEY=<your OpenAI API key> | ||
GITLAB_TOKEN=<your GitLab API token> | ||
GITLAB_URL=https://gitlab.com/api/v4 | ||
EXPECTED_GITLAB_TOKEN=<your expected GitLab token> | ||
``` | ||
4. Run the application: | ||
``` | ||
python app.py | ||
``` | ||
|
||
|
||
### Docker | ||
|
||
Alternatively, you can use Docker to run the application: | ||
|
||
1. Build the Docker image: | ||
``` | ||
docker-compose build | ||
``` | ||
2. Run the Docker container: | ||
``` | ||
docker-compose up -d | ||
``` | ||
|
||
|
||
## Usage | ||
|
||
1. Configure your GitLab repository to send webhook events to the AI Code Reviewer application by following [GitLab's webhook documentation](https://docs.gitlab.com/ee/user/project/integrations/webhooks.html). | ||
|
||
2. The AI Code Reviewer application will automatically review code changes in your GitLab repository and provide feedback as comments on merge requests and commit diffs. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters