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!
- [Rust] Improve support for host functions in the WasmEdge Rust SDK
- [bash] Support ARM architecture in the WasmEdge installer
- [C++] Add an eBPF plugin for WasmEdge
- [Haskell] Improve the CLI utility for WasmEdge Component Model tooling
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.
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".
- Create a bot from a template
- Add your OpenAI API key
- Configure the bot to review PRs on a specified GitHub repo
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.
Review the trigger_phrase
variable. It is the magic words you type in a PR comment to manually summon the review bot.
Click on the Create and Build button.
You will now set up OpenAI integration. Click on Connect, enter your key and give it a name.
Close the tab and go back to the flow.network page once you are done. Click on Continue.
Next, you will tell the bot which GitHub repo it needs to monitor for upcoming PRs to review.
github_owner
: GitHub org for the repo you want to deploy the 🤖 on.github_repo
: GitHub repo you want to deploy the 🤖 on.
Let's see an example. You would like to deploy the bot to review code in PRs on
WasmEdge/wasmedge_hyper_demo
repo. Heregithub_owner = WasmEdge
andgithub_repo = wasmedge_hyper_demo
.
Click on the Connect or + Add new authentication button to give the function access to the GitHub repo to deploy the 🤖. You'll be redirected to a new page where you must grant flows.network permission to the repo.
Close the tab and go back to the flow.network page once you are done. Click on Deploy.
This is it! You are now on the flow details page waiting for the flow function to build. As soon as the flow's status became running
, the bot is ready to give code reviews! The bot is summoned by every new PR, every new commit, as well as magic words (i.e., trigger_phrase
) in PR comments.
The bot's source code is available in the GitHub repo you cloned from the template. Feel free to make changes to the source code (e.g., model, context length, API key and prompts) to fit your own needs. If you need help, ask in Discord!
By default, the bot uses GPT3.5 for code review. If your OpenAI API key has access to GPT4, you can open the src/github-pr-review.rs
file
in your cloned source code repo, and change GPT35Turbo
to GPT4
in the source code. Commit and push the change back to GitHub.
The flows.network platform will automatically detect and rebuild the bot from your updated source code.
You can mannually create a new flow and import the source code repo for the bot (i.e., the repo you cloned from the template). Then, you can use the flow config to specify the github_owner
and github_repo
to point to the target repo you need to deploy the bot on. Deploy and authorize access to that target repo.
You can repeat this for all target repos you would like to deploy this bot on.
You could have a single flow function repo deployed as the source code for multiple bots. When you update the source code in the repo, and push it to GitHub, it will change the behavior of all the bots.
Go to the "Settings" tab of the running flow function for the bot, you can update the trigger_phrase
config. The value of this config is the magic phrase the user will say to trigger a review from a PR comment.
This flow function is originally created by Jay Chen, and jinser made significant contributions to optimize the event triggers from GitHub.