Skip to content

ReshiAdavan/Sleepy

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

42 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Sleepy

Sleepy is a GitHub Action tool that leverages OpenAI's GPT-4 API to provide intelligent feedback and suggestions on your pull requests. It helps improve code quality and saves developers time by automating PR review processes.

Inspiration

Reviews are one of the biggest reasons why code fails or takes too long to reach production. I notice a lot of tech leads and senior engineers who spend a lot of time reviewing PRs because they have to, and it takes too much time away from other important endeavours. As of the recent breakthrough of AI, I believe it would be more efficient to leverage AI in code reviews, especially if it has been trained over billions of lines of code and if it can generate great reviews in seconds.

How It Works

Sleepy retrieves pull request diffs, filters out excluded files, and sends code chunks to the OpenAI API. It then generates review comments based on the AI's response and adds them to the pull request.

Use It Yourself

  1. Sign up for an API key at OpenAI if you don't have one.

  2. Add the OpenAI API key as a GitHub Secret in your repository with name OPENAI_API_KEY. More info on GitHub Secrets here.

  3. Create a .github/workflows/main.yml file in the repository you want this tool to function in with the following content:

name: Sleepy the Code Reviewer
on:
  pull_request:
    types:
      - opened
      - synchronize
permissions: write-all
jobs:
  review:
    runs-on: ubuntu-latest
    steps:
      - name: Checkout Repo
        uses: actions/checkout@v3

      - name: Sleepy the Code Reviewer
        uses: ReshiAdavan/Sleepy@master
        with:
          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
          OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }}
          OPENAI_API_MODEL: "gpt-4" # Optional: defaults to "gpt-4"
          exclude: "**/*.json, **/*.md" # Optional: exclude patterns separated by commas

Examples

To see live examples of the code review tool in action, refer to the Compilation of Examples

About

An AI GitHub Actions Tool that leverages GPT-4 to provide intelligent feedback and suggestions on pull requests.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published