0.0
No release in over a year
Pushes current local branch to remote with upstream at origin/[local-branch-name]. It also opens a new pull request browser window at a URL with customized query params, based on specified options, which pre-populates certain fields in the pull request. This is especially useful when supporting multiple PR templates within a code base.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

~> 5.18.0
~> 1.39
~> 0.13.1

Runtime

~> 2.5
~> 13.0
>= 0
 Project Readme

PRWithParams Gem Version

A lightweight ruby gem that pushes current local branch to remote with upstream at origin/[local-branch-name]. It also opens a new pull request browser window at a URL with customized query params, based on specified options, which pre-populates certain fields in the pull request. This is especially useful when supporting multiple PR templates within a code base.

Inspired by GitHub's documentation on using query params to create pull requets

Installation

Add this line to your application's Gemfile:

gem 'pr-with-params'

And then execute:

$ bundle install

Or install it yourself as:

$ gem install pr-with-params

Usage

NOTE: CLI name has changed as of v2.0.0 from pr-with-params to pr-wip along with some other breaking changes. See changelog for more details

Assuming you've committed your changes and your local branch is ready to be pushed, run:

$ pr-wip -t new_feature_template.md -l 'work in progress'

For a full list of options, run $ pr-wip -h

Using Config File

Gem supports defining options in a yaml file (.yaml, .yml) like so:

default:
  validators:
    - conventional_commits
  base_branch: main
  template: new_feature_template.md
  assignees: 2k-joker
  labels: enhancement

bug_fix:
  template: bug_fix_template.md
  labels: bug,urgent
  • To run with config file, use $ pr-wip --config_path='path/to/file.yml' --scope=bug_fix. If --scope option is not specified, only :default scope will apply.
  • If you specify a config file (--config_path) and also pass options by flag (e.g --base-branch=develop), the flag value will override the config value.
  • All your defaults go in the :default scope.
  • Only fields defined in another scope will override the defaults. In the example above, the final list of configs will be:
{ validators: ['conventional_commits'], base_branch: 'main', template: 'bug_fix_template.md', assignees: '2k-joker', labels: 'bug,urgent' }

Supported configs

Config Type Example
validators Array `[conventional_commits]`
ignore_conventional_commits Boolean true
base_branch String develop
template String new_feature_template.md
title String 'Update login screen'
lables String frontend,WIP
assignees String 2k-joker

Validators

  • Conventional Commits: Gem supports validation of conventional commits for PR :title by default. This is to encourage users to follow conventional commit specs. To turn it off, pass the --ignore-conventional-commits flag or add conventional_commits to the list of validators in your config file or set ignore_conventional_commits: true in your config file.

Development

After checking out the repo, run bin/setup to install dependencies. Then, run rake test to run the tests. You can also run bin/console for an interactive prompt that will allow you to experiment.

To install this gem onto your local machine, run bundle exec rake install. To release a new version, update the version number in version.rb, and then run bundle exec rake release, which will create a git tag for the version, push git commits and the created tag, and push the .gem file to rubygems.org.

Contributing

Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/pr-with-params.