WIP: this project still has more features coming soon!
Generates concise summaries and suggestions for GitHub Pull Requests using GPT-4.
- Summarizes PR changes
- Suggests improvements and points out issues
- Praises good practices
- Posts comment summarizing feedback to the PR
- Automatically de-duplicates comments on subsequent commits to the PR
- Pass/Fail recommendation for each PR that allows the workflow to fail if a major flaw is detected
This project is designed to run as a GitHub Action using Docker. It fetches the PR diff and sends it to OpenAI for review.
Minimal example:
- name: AI PR Reviewer
uses: annaelizabeth2019/code-review-tool@main
env:
OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }}
-
Clone the repository:
git clone https://github.com/annaelizabeth2019/code-review-tool.git cd code-review-tool
-
Install dependencies:
pip install -r requirements.txt
-
Set up environment variables:
- Create a
.env
file in the project root:OPENAI_API_KEY=your_openai_api_key_here GITHUB_EVENT_PATH=sample_event.json
- Update the sample_event.json diff link to test the response for different PR diffs.
- Or export them directly in your shell.
- Create a
-
Run the tool locally:
python main.py
This will use
sample_event.json
as the event payload and print the AI review to the console.
OPENAI_API_KEY
: Your OpenAI API key (required)GITHUB_EVENT_PATH
: Path to the GitHub event JSON (set automatically in Actions, set manually for local testing)
main.py
— Entry point, handles event and diff fetchingai_reviewer/openai.py
— Handles OpenAI API callssample_event.json
— Example event payload for local testingaction.yml
— GitHub Action definitionDockerfile
— Container setup for GitHub Actions
Pull requests and issues are welcome! For major changes, please open an issue first to discuss what you’d like to change. Also please get in touch with feature requests!
MIT