- Notifications
You must be signed in to change notification settings - Fork2
Generate pull request description or create a review using chatgpt
License
ravilushqa/gpt-pullrequest-updater
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
Repository files navigation
This repository contains a tool for updating and reviewing GitHub pull requests using OpenAI's GPT language model. The project has two commands:description
andreview
. Thedescription
command updates the pull request description with a high-level summary of the changes made. Thereview
command creates individual comments for each file and an overall review summary comment.
- GitHub token with access to the desired repository
- OpenAI API token
go install github.com/ravilushqa/gpt-pullrequest-updater/cmd/description@latestgo install github.com/ravilushqa/gpt-pullrequest-updater/cmd/review@latest
Usage:
review [OPTIONS]
Application Options:
--gh-token= GitHub token [$GITHUB_TOKEN] --openai-token= OpenAI token [$OPENAI_TOKEN] --owner= GitHub owner [$OWNER] --repo= GitHub repo [$REPO] --pr-number= Pull request number [$PR_NUMBER] --openai-model= OpenAI model (default: gpt-3.5-turbo) [$OPENAI_MODEL] --test Test mode [$TEST]
Help Options:
-h, --help Show this help message
Before running the command, make sure you have set the appropriate options or environment variables. The command line options will take precedence over the environment variables.
To run thereview
command, execute:
./review --gh-token=<GITHUB_TOKEN> --openai-token=<OPENAI_TOKEN> --owner=<OWNER> --repo=<REPO> --pr-number=<PR_NUMBER> --test
Replace<GITHUB_TOKEN>
,<OPENAI_TOKEN>
,<OWNER>
,<REPO>
, and<PR_NUMBER>
with the appropriate values. If you want to enable test mode, add the--test
flag.
The usage for thedescription
command is similar to thereview
command. Replacereview
withdescription
in the command above and execute.Only difference is thatdescription
command has extra option--jira-url
which is used to generate Jira links in the description.
This script can be used as a GitHub Action, allowing it to run automatically in your repository. To get started, add a new workflow file in your repository, such as:.github/workflows/gpt_pullrequest_updater.yml
.
Here's an example of what the workflow file could look like:
name:GPT Pull Request Updateron:pull_request:types: -opened -synchronizejobs:update_pull_request:runs-on:ubuntu-lateststeps: -name:Set up Gouses:actions/setup-go@v2with:go-version:1.19 -name:Checkout GPT-PullRequest-Updateruses:actions/checkout@v2with:repository:ravilushqa/gpt-pullrequest-updaterpath:gpt-pullrequest-updater -name:Build description and review commandsrun:| cd gpt-pullrequest-updater make build -name:Update Pull Request Descriptionrun:| ./gpt-pullrequest-updater/bin/descriptionenv:GITHUB_TOKEN:${{ secrets.GITHUB_TOKEN }}OPENAI_TOKEN:${{ secrets.OPENAI_TOKEN }}OWNER:${{ github.repository_owner }}REPO:${{ github.event.repository.name }}PR_NUMBER:${{ github.event.number }} -name:Review Pull Requestif:github.event.action == 'opened'run:| ./gpt-pullrequest-updater/bin/reviewenv:GITHUB_TOKEN:${{ secrets.GITHUB_TOKEN }}OPENAI_TOKEN:${{ secrets.OPENAI_TOKEN }}OWNER:${{ github.repository_owner }}REPO:${{ github.event.repository.name }}PR_NUMBER:${{ github.event.number }}
Make sure to add your OpenAI API token to your repository secrets asOPENAI_TOKEN
.
In order to use this GitHub Action, you need to grant the necessary permissions to the GitHub token. To do this, follow these steps:
- Go to the repository settings page:https://github.com/OWNER/REPO/settings
- Navigate to the "Actions" tab on the left side of the settings page.
- Scroll down to the "Workflow Permissions" section.
Select "Read and Write" permissions for the actions. This will provide your token with the necessary rights to modify your repository.By following these steps, you'll grant the required permissions for the GPT-PullRequest-Updater GitHub Action to function properly, allowing it to update and review pull requests in your repository.
LicenseThis project is licensed under the MIT License.
About
Generate pull request description or create a review using chatgpt
Topics
Resources
License
Uh oh!
There was an error while loading.Please reload this page.
Stars
Watchers
Forks
Packages0
Uh oh!
There was an error while loading.Please reload this page.
Contributors3
Uh oh!
There was an error while loading.Please reload this page.