Giter VIP home page Giter VIP logo

git-open-pull's Introduction

git open-pull

Create a pull request from the command line, or attach a branch to an open GitHub issue converting it into a pull request.

USAGE

$ git open-pull

git-open-pull takes the following optional arguments:
--interactive - boolean flag to turn off interactive mode; this is default set to true
--description-file - path to a file that contains your PR description
--title - string title for your PR
--labels - comma separated list of labels to be added to you PR
--version - print version of git-open-pull and Go

$ git open-pull --interactive=false --description-file="description.txt" --labels="label1, label2" --title="My PR Title"

Installing

Install from source, or visit the releases page

go install github.com/jehiah/git-open-pull@latest

CONFIGURATION

If available, git-open-pull will use the following config values. When not available They will be requested on the command line. Note: storing your GitHub API credentials this way is not secure. Your API credentials will be stored in plain text.

[github]
    user = ....
[gitOpenPull]
    token = ..... # GitHub Access Token generated from https://github.com/settings/tokens
    baseAccount = ....
    baseRepo = .....
    base = master
    # Allow maintainers of the upstream repo to modify this branch
    # https://help.github.com/articles/allowing-changes-to-a-pull-request-branch-created-from-a-fork/
    maintainersCanModify = true | false (default: true)
[core]
    editor = /usr/bin/vi

Hooks. git-open-pull provides the ability to modify an issue template (preProcess or postProcess) or to be notified after a PR is created (callback). pre/post process commands are executed with the first argument continaing a filename with the issue template. Callback is executed with the first argument containing the filename of a file with the json results from the GitHub api of PR details

[gitOpenPull]
    preProcess = /path/to/exe
    postProcess = /path/to/exe
    callback = /path/to/exe

git-open-pull will also look for the following environment variables, which will take precendence over values found in the config file.

GITOPENPULL_TOKEN
GITOPENPULL_USER
GITOPENPULL_BASE_ACCOUNT
GITOPENPULL_BASE_REPO
GITOPENPULL_PRE_PROCESS
GITOPENPULL_POST_PROCESS
GITOPENPULL_CALLBACK
GITOPENPULL_BASE_BRANCH
GITOPENPULL_MAINTAINERS_CAN_MODIFY
GITOPENPULL_EDITOR

ABOUT

Because the ideal workflow is issue -> branch -> pull request this script takes a GitHub issue and turns it into a pull request based on your branch against master in the integration account

Building From Source

This project uses Go Modules to manage dependencies.

go build

git-open-pull's People

Contributors

dianaabishop avatar jehiah avatar jharshman avatar jonathancross avatar jsocol avatar mccutchen avatar mreiferson avatar mrwoof avatar pevans96 avatar ploxiln avatar sricola avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

git-open-pull's Issues

Support branches with numeric endings

The current logic in the DetectIssueNumber() function will convert all instances of the passed in branch name from - to _ and parse out any trailing number sequence to interpret as an existing issue number.

This causes a problem with branches ending in numeric values as they are interpreted as an existing issue. I recently experienced this with a branch name of cve-2021-3156.

Output

$ git-open-pull
current branch cve-2021-3156
issue number [3156]: 

Expected

I would expect the branch to be renamed with a new issue number, i.e: cve-2021-3156_<issue_number> and that issue and correlating PR be created.

bug fix on --description-file

In interactive mode, use inputDescription only at the outset if it is provided, otherwise generate description.

Don't override processed description.

Use get-branch instead of list-branches (with a limit:100)

When folks don't strictly manage their outstanding branches and pass the 100 limit, git-open-pull can't always find the branch on github to open-pull against (depending on sorting).

Github now has a get-branch endpoint that should be used instead of list-branches

https://developer.github.com/v3/repos/branches/#get-branch

branches, _, err := client.Repositories.ListBranches(ctx, settings.User, settings.BaseRepo, &github.ListOptions{PerPage: 100})

cc: @kpurdon

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.