A Swift command-line tool to generate a pull request by taking the leverage of GITHUT CLI and git commit logs on current branch, then create a draft Pull requests.
- Swift 5.2
- OSX
The intension of this command line tool is to automate some of the redundant manual processes. I have used swift-argument-parser and github-cli. It will:
- Get all the commit logs against the base branch
- Generate full pr description according to git commit logs and given optional extra description.
- Push the working branch to remote origin. At the moment,
gh pr createwill not push branch to the server cli/cli#1718. Thus, we need to manually push the working branch to origin - Create pull request by using
gh pr create - Optional, it will open the created pull request url on the default browser.
For now, need to be in Mac enviroment with git command line tool and github cli installed,
- Install git https://github.com/git-guides/install-git
- Install homebrew https://github.com/Homebrew/install
To install it, simply add the following lines Ready Set goal ~~~~~
git clone https://github.com/Mieraidihaimu/GeneratePR.git
cd GeneratePR
#This will build, export the executable binary `gen-pr` and install dependency package Github CLI
makeonce you have moved binary file as gen-pr, you can start creating PR like
gen-pr "title" "Mieraidihaimu/GeneratePR/issues/1" -e "no need to panic" --fix -othen you can sit back and relex. Here are the usage
USAGE: gen-pr <title> [--extra-description <extra-description>] [--base-branch <base-branch>] [--feature] [--fix] <issue> [--verbose] [--open-URL]
ARGUMENTS:
<title> The pull request title
<issue> Linked github issue path. For instance, in issue URL
https://github.com/randomX/repoY/issues/1060, the
`randomX/repoY/issues/1060` is the issue path
OPTIONS:
-e, --extra-description <extra-description>
The PR extra description for pull request.
-b, --base-branch <base-branch>
The base branch which the pull requests will be open
to, default is main (default: main)
--feature/--fix The PR type: is it a feature or bug fix PR?. Default
value is feature PR. (default: feature)
-v, --verbose Show logs, information and non blocking messages.
-o, --open-URL Open Pull request URL on default browser.
-h, --help Show help information.
To learn more please use --help or visit https://github.com/Mieraidihaimu/GeneratePR
-
Install Mint
-
Run GeneratePR on the fly
$ mint run Mieraidihaimu/GeneratePR@main ...
or install the package locally
$ mint install Mieraidihaimu/GeneratePR@main 🌱 Cloning GeneratePR main 🌱 Resolving package 🌱 Building package 🌱 Installed GeneratePR main 🌱 Linked GeneratePR main to ~/.mint/bin 🌱 ~/.mint/bin must be added to your $PATH if you wish to run this package outside of mint $ type GeneratePR GeneratePR is ~/.mint/bin/GeneratePR
- Fork it! 👀
- Create your feature branch:
git checkout -b name/my-new-feature - Commit your changes:
git commit -am 'Add some feature' - Push to the branch:
git push origin name/my-new-feature - Submit a pull request :D 🙈
- Get thumbs up and 👍
- Email : mieraisan@gmail.com
GeneratePR is released under the MIT license. See LICENSE for details.