https://github.com/gvasilei/AutoReviewer
Use LLMs to perform automatic code reviews.
https://github.com/gvasilei/AutoReviewer
ai chatgpt codereview effect-ts github-actions gpt langchain llm openai
Last synced: 10 months ago
JSON representation
Use LLMs to perform automatic code reviews.
- Host: GitHub
- URL: https://github.com/gvasilei/AutoReviewer
- Owner: gvasilei
- License: mit
- Created: 2023-05-01T08:21:48.000Z (almost 3 years ago)
- Default Branch: main
- Last Pushed: 2024-06-24T17:49:02.000Z (over 1 year ago)
- Last Synced: 2024-10-02T01:01:32.147Z (over 1 year ago)
- Topics: ai, chatgpt, codereview, effect-ts, github-actions, gpt, langchain, llm, openai
- Language: TypeScript
- Homepage:
- Size: 2.91 MB
- Stars: 40
- Watchers: 3
- Forks: 14
- Open Issues: 7
-
Metadata Files:
- Readme: README.md
- License: LICENSE
- Codeowners: CODEOWNERS
Awesome Lists containing this project
README
# 🤖 Automated Code Reviews powered by ChatGPT 🤖
A GitHub action uses OpenAI's GPT-4 to perform automated code reviews. When you create a PR, our action will automatically review the code and suggest changes, just like a human code reviewer would.
## 🚀 How to use it
- Get an API Key from [OpenAI](https://platform.openai.com/account/api-keys)
- Add it as a GitHub secret
- Setup an action that runs on every PR
```YAML
name: 'code-review'
on: # rebuild any PRs and main branch changes
pull_request:
jobs:
code-review:
runs-on: ubuntu-latest
permissions:
contents: read
pull-requests: write
steps:
- uses: actions/checkout@v3
- uses: gvasilei/AutoReviewer@0.5.1
env:
NODE_OPTIONS: '--experimental-fetch'
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
openai_api_key: ${{ secrets.OPENAI_API_KEY }}
exclude_files: '*.json, *.md, *.yml' # optionally exclude files based on a wildcard expression.
```
- Or when a label is added
```YAML
name: 'code-review'
on: # rebuild any PRs and main branch changes
pull_request:
types: [labeled]
jobs:
code-review:
if: ${{ contains( github.event.label.name, 'AutoReview') }}
runs-on: ubuntu-latest
permissions:
contents: read
pull-requests: write
steps:
- uses: actions/checkout@v3
- uses: gvasilei/AutoReviewer@0.5.1
env:
NODE_OPTIONS: '--experimental-fetch'
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
openai_api_key: ${{ secrets.OPENAI_API_KEY }}
exclude_files: '*.json, *.md, *.yml' # optionally exclude files based on a wildcard expression.
```
## Input parameters
| **Parameter** | **Required** | **Default** | **Description** |
|-------------------|--------------|---------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| github_token | True | | Necessary for communicating with GitHub. Autogenerated by the GHA |
| openai_api_key | True | | OpenAI API key |
| model_name | False | gpt-3.5-turbo | OpenAI ChatModel. Currently supports `gpt-4` and `gpt-3.5-turbo` |
| model_temperature | False | 0 | OpenAI model temperature |
| exclude_files | False | | Provide a wildcard expression to exclude files from code review. For example, `*.md` will exclude all Markdown files. Multiple expressions are supported via commas, eg `*.js, *.cjs` |
## 🎉 Benefits
Using our GitHub action has many benefits, such as:
- Faster code reviews
- More consistent feedback
- Increased productivity
- Improved code quality
## 🤞 Limitations
- This GitHub Action is still in early development.
- While the action supports both `gpt-4` and `gpt-3.5-turbo`, `gpt-4` gives much better suggestions.
## 🙌 Contributing
If you have any ideas or improvements to our GitHub action, feel free to submit a PR. We welcome all contributions!