• Stars
    star
    3,866
  • Rank 11,343 (Top 0.3 %)
  • Language
    JavaScript
  • License
    ISC License
  • Created almost 2 years ago
  • Updated 5 months ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

🐥 A code review bot powered by ChatGPT

CodeReview BOT

A code review robot powered by ChatGPT

Translation Versions: ENGLISH | 中文简体 | 中文繁體 | 한국어 | 日本語

Bot Usage

❗️⚠️ Due to cost considerations, BOT is only used for testing purposes and is currently deployed on AWS Lambda with ratelimit restrictions. Therefore, unstable situations are completely normal. It is recommended to deploy an app by yourself.

Install

Install: apps/cr-gpt;

Configuration

  1. Go to the repo homepage which you want integrate this bot
  2. click settings
  3. click actions under secrets and variables
  4. Change to Variables tab, create a new variable OPENAI_API_KEY with the value of your open api key (For Github Action integration, set it in secrets) image

Start using

  1. The robot will automatically do the code review when you create a new Pull request, the review information will show in the pr timeline / file changes part.
  2. After git push update the pull request, cr bot will re-review the changed files

example:

ChatGPT-CodeReview/pull/21

image

Using Github Actions

actions/chatgpt-codereviewer

  1. add the OPENAI_API_KEY to your github actions secrets
  2. create .github/workflows/cr.yml add bellow content
name: Code Review

permissions:
  contents: read
  pull-requests: write

on:
  pull_request:
    types: [opened, reopened, synchronize]

jobs:
  test:
    # if: ${{ contains(github.event.*.labels.*.name, 'gpt review') }} # Optional; to run only when a label is attached
    runs-on: ubuntu-latest
    steps:
      - uses: anc95/ChatGPT-CodeReview@main
        env:
          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
          OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }}
          # Optional
          LANGUAGE: Chinese
          OPENAI_API_ENDPOINT: https://api.openai.com/v1
          MODEL: gpt-3.5-turbo
          PROMPT:
          top_p: 1
          temperature: 1
          max_tokens: 10000
          MAX_PATCH_LENGTH: 10000 # if the patch/diff length is large than MAX_PATCH_LENGTH, will be ignored and won't review. By default, with no MAX_PATCH_LENGTH set, there is also no limit for the patch/diff length.

Self-hosting

  1. clone code
  2. copy .env.example to .env, and fill the env variables
  3. install deps and run
npm i
npm -i g pm2
npm run build
pm2 start pm2.config.cjs

probot for more detail

Dev

Setup

# Install dependencies
npm install

# Run the bot
npm start

Docker

# 1. Build container
docker build -t cr-bot .

# 2. Start container
docker run -e APP_ID=<app-id> -e PRIVATE_KEY=<pem-value> cr-bot

Contributing

If you have suggestions for how cr-bot could be improved, or want to report a bug, open an issue! We'd love all and any contributions.

For more, check out the Contributing Guide.

Credit

this project is inpired by codereview.gpt

License

ISC © 2023 anc95

More Repositories

1

writely

❤️‍🔥 A chrome extension as an alternative to Notion AI that goes beyond Notion AI. | 一个替代 Notion AI 的浏览器插件,不止于 Notion AI
TypeScript
1,227
star
2

inquirer-file-tree-selection

inquirer prompt for select a file or dir by file tree
TypeScript
50
star
3

jest-chain-transform

Using multiple transformers for one type of rule file in jest
TypeScript
16
star
4

decrypt-chrome-cookie

decrypt chrome cookie in javascript way
JavaScript
10
star
5

figma-to-bundled-html

A figma plugin to transform figma UI to a bundled html
TypeScript
6
star
6

golang-enum-to-ts

Transform Golang `enum` type to Typescript enum
Go
6
star
7

commitmsg-with-jira-ticket

Add Jira ticket in interactive way to your commit msg
TypeScript
3
star
8

postcss-flex-value

A postcss plugin to transform flex value such as "start" to "flex-start"
JavaScript
2
star
9

anc95

2
star
10

packweb

it is not webpack!!!!! it a impelement of webpack when i learn it. so it named packweb
JavaScript
1
star
11

chrome-extension-confluence-markdown-editor

A chrome extension to enable write markdown in confluence
1
star
12

books

books assets I read
1
star
13

linaria-template-string-demo

JavaScript
1
star
14

test

HTML
1
star
15

login-manager

一个管理cookie的electron应用
JavaScript
1
star
16

alfred-can-i-use-search

"Can I use" provides up-to-date browser support tables for support of front-end web technologies on desktop and mobile web browsers.
Python
1
star
17

prop-types-parser

parse prop-types to analysis react components props data stucture
TypeScript
1
star
18

golang-enum-to-ts-playground

A playground for `golang-enum-to-ts`
JavaScript
1
star
19

monkey-scripts

A collection of convenient monkey scripts for myself (自用的油猴脚本合集)
JavaScript
1
star