featbit / flownetwork-github-pr-summary

Use ChatGPT to summarize & review GitHub Pull Requests

Home Page:https://flows.network/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

GPT Nitro for Github PR

flows.network Discord flows.network Twitter Create a flow

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

We're launching on Product Hunt. Show your support by upvoting us and help us bring our innovative solution to a wider audience. Let's make this launch a success together.

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. 🀯

How it works

This flow function (or πŸ€–) will be triggered and executed when a new PR is raised in the designated GitHub repo. It can also be triggered again when someone says a magic "trigger phrase" in the PR's comments section. Once triggered, 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 runs in hosted WasmEdge Runtimes on flows.network.

The GitHub repo is connected to the flow function via the flows.network platform. The "trigger phrase" can also be configured in flows.network.


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 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.

image

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

The 5 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: Fill in your personal GitHub id here. The GitHub app will act as you when posting reviews.
  • owner: Fill in the GitHub org for the repo you want to deploy the πŸ€– on.
  • repo : Fill in the GitHub repo you want to deploy the πŸ€– on.
  • openai_key_name: Fill in any name you wish for your OpenAI API key. You will connect this name to the actual key later.
  • trigger_phrase: Fill in 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. You could paste your OpenAI API key here and then give it a name. Note the name here must match the name in the openai_key_name environment variable.

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.

About

Use ChatGPT to summarize & review GitHub Pull Requests

https://flows.network/


Languages

Language:Rust 100.0%