Skip to content

Use ChatGPT to summarize & review GitHub Pull Requests

Notifications You must be signed in to change notification settings

farzonl/github-pr-summary

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 

Repository files navigation

ChatGPT/4 code reviewer for Github PR

flows.network Discord flows.network Twitter Create a flow

Deploy this function on flows.network, and you will get a GitHub 🤖 to review and summarize Pull Requests. It helps busy open source contributors understand and make decisions on PRs faster! A few examples below!

Still not convinced? See "potential problems 1" in this review, it identified an inefficient Rust implementation of an algorithm. 🤯

This bot summarizes commits in the PR. Alternatively, you can use this bot to review changed files in the PR.

How it works

This flow function (or 🤖) will be triggered when a new PR is raised in the designated GitHub repo. The flow function collects the content in the PR, and asks ChatGPT/4 to review and summarize it. The result is then posted back to the PR as a comment. The flow functions are written in Rust and run in hosted WasmEdge Runtimes on flows.network.

  • The code review comment is updated automatically every time a new commit is pushed to this PR.
  • A new code review could be triggered when someone says a magic trigger phrase in the PR's comments section. The default trigger phrase is "flows summarize".

Deploy your own code review bot in 3 simple steps

  1. Fork this repo to your own GitHub account. It contains the source code for the GitHub bot.
  2. Import the forked repo on flows.network as a flow function.
  3. Connect the flow function to the GitHub repo you want to deploy the bot on (using the flows.network UI).


Click on the picture above to watch a 3-min tutorial video

Prerequisites

You will need to bring your own OpenAI API key. If you do not already have one, sign up here.

You will also need to sign into flows.network from your GitHub account. It is free.

Deploy the PR review 🤖 onto your GitHub repos

The 🤖 is designed to run on flows.network, a serverless platform for SaaS and AI automation.

1 Fork this repo

Fork this repo into your own GitHub account.

If your OpenAI API key has GPT4 access, you can change GPT35Turbo to GPT4 in your fork of the source code. GPT4 provides substantially better code reviews, but it is also 10x more expensive.

2 Deploy the bot's source code on flow.network

Go to flows.network to deploy your own flow function (🤖) from the forked source code.

  1. Click on the "Create a Flow" button to start.
  2. Authenticate the flows.network to access the github-pr-summary repo you just forked. NOTE: This is NOT the repo you want to install the bot on.

image

  1. Click on the "Advanced" link to see more settings. Fill in the following environment variables.

The 4 variables below are defined in the flow function's Rust source code. You can assign their values in the source code in your fork directly and skip the steps below.

  • login: Your personal GitHub id. The GitHub app will act as you when posting reviews.
  • owner: GitHub org for the repo you want to deploy the 🤖 on.
  • repo : GitHub repo you want to deploy the 🤖 on.
  • trigger_phrase: Optional -- The magic phrase to trigger a review from a PR comment.

Let's see an example. You forked the flow function source code to my-name/github-pr-summary and would like to deploy the bot to summarize PRs on my-company/work-project repo. Here login = my-name, owner = my-company and repo = work-project.

image

  1. Click on the Deploy button.

3 Configure integrations

After that, flows.network will direct you to configure the external services required by your flow function 🤖.

image

For this flow function, we need to configue two integrations.

  1. Click on the "Connect" or "+ Add new authentication" button to add your OpenAI API key.

image

  1. Click on the "Connect" or "+ Add new authentication" button to give the function access to the GitHub repo to deploy the 🤖. That is to give access to the owner/repo in the environment variables. You'll be redirected to a new page where you must grant flows.network permission to the repo.

After that, click on the "Check" button to go to the flow details page. As soon as the flow's status became running, the PR summary GitHub bot is ready to give code reviews! The bot is summoned by every new PR or magic words (i.e., trigger_phrase) in PR comments.

image

Credits

This flow function is originally created by Jay Chen, and jinser made significant contributions to optimize the event triggers from GitHub.

GPT Nitro for Github PR - A ChatGPT-based reviewer for your GitHub pull requests | Product Hunt

About

Use ChatGPT to summarize & review GitHub Pull Requests

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Rust 100.0%