Coder Social home page Coder Social logo

smart-review's Introduction

Smart Review

This GitHub Action uses OpenAI to provide AI-powered code reviews. With this action, you can get feedback on your PR's, which can help you catch errors, performance issues and improve the overall quality of your codebase. Users can also adjust the focus and output format of the review by modifying the systemMessage.

An example of AI review feedback looks like this:

smart-review

This project was inspired by anc95/ChatGPT-CodeReview, the main differences are that it allows customizing the systemMessage to adjust the focus and output format of the AI review according to one's own needs. And it can be triggered from a forked pull request.

Inputs

  • apiKey (required): The OpenAI API key.
  • githubToken (required): The GitHub token.
  • model (optional): The model used to review code. Defaults to gpt-3.5-turbo.
  • temperature (optional): The model temperature. Defaults to 0.1.
  • top_n (optional): The model top_n. Defaults to 1.
  • systemMessage (optional): The system message sent to the ChatGPT API, which allows you to focus on specific areas for review.

Example Usage

You only need to set the secret OPENAI_API_KEY in your repo before running the action. The GITHUB_TOKEN secret will be set automatically by Github Action.

name: Smart Review
permissions:
  contents: read
  pull-requests: write

on:
  pull_request_target:
    types: [opened, synchronize]

jobs:
  review-code:
    runs-on: ubuntu-latest
    steps:
      - name: test review
        uses: oilbeater/smart-review@main
        with:
          apiKey: ${{ secrets.OPENAI_API_KEY }}
          githubToken: ${{ secrets.GITHUB_TOKEN }}

In this example, the action will be triggered upon the opening of a pull request or the pushing of new commits, and will subsequently generate review feedback within the corresponding pull request thread.

Notice: If you don't want to use your OPENAI_API_KEY for review pr from forked repo, replace pull_request_target with pull_request.

Limitation

  • The Azure OpenAI endpoint is currently unsupported.
  • A patch of significant size may exceed the token limit for OpenAI.

smart-review's People

Contributors

oilbeater avatar ltarabarova avatar

Watchers

James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.