From 2dc9c26e36b78e42291be105ab7f232312bf0135 Mon Sep 17 00:00:00 2001 From: vyas <10957095+v-y-a-s@users.noreply.github.com> Date: Wed, 5 Aug 2020 11:59:43 +0530 Subject: [PATCH 1/7] PR test --- bin/git-pull-request | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/bin/git-pull-request b/bin/git-pull-request index 8a0ad0300..573d30beb 100755 --- a/bin/git-pull-request +++ b/bin/git-pull-request @@ -38,6 +38,18 @@ fi test -z "$user" && abort "git config user.email required" +# personal access token + +personal_access_token=$(git config git-extras.personal-access-token) + +# if [ -z "$personal_access_token" ] +# then +# personal_access_token="master" +# fi + +echo "My Personal Access Token Is : " $personal_access_token +test -z "$personal_access_token" && abort "git config git-extras.personal_access_token required" + # branch branch=${1-$(git symbolic-ref HEAD | sed 's/refs\/heads\///')} @@ -80,7 +92,10 @@ fi body=$(json "$title" "$body" "$branch" "$base") -curl -u "$user" \ - -H "X-GitHub-OTP: $mfa_code" \ +curl \ + -X POST \ + -H "Accept: application/vnd.github.v3+json" \ + -H "Authorization: token $personal_access_token" \ + -H "X-GitHub-OTP: $mfa_code" \ "https://api.github.com/repos/$project/pulls" -d "$body" From 49a34037addbebc3debf14bcd6e7cab9e930eeae Mon Sep 17 00:00:00 2001 From: vyas <10957095+v-y-a-s@users.noreply.github.com> Date: Wed, 5 Aug 2020 16:19:51 +0530 Subject: [PATCH 2/7] Remove comments --- bin/git-pull-request | 6 ------ 1 file changed, 6 deletions(-) diff --git a/bin/git-pull-request b/bin/git-pull-request index 573d30beb..5dfd6aa7c 100755 --- a/bin/git-pull-request +++ b/bin/git-pull-request @@ -42,12 +42,6 @@ test -z "$user" && abort "git config user.email required" personal_access_token=$(git config git-extras.personal-access-token) -# if [ -z "$personal_access_token" ] -# then -# personal_access_token="master" -# fi - -echo "My Personal Access Token Is : " $personal_access_token test -z "$personal_access_token" && abort "git config git-extras.personal_access_token required" # branch From a0d70394826bf42f8a02025d0db4ab08cc681cfb Mon Sep 17 00:00:00 2001 From: vyas <10957095+v-y-a-s@users.noreply.github.com> Date: Wed, 5 Aug 2020 16:22:44 +0530 Subject: [PATCH 3/7] fix config message name --- bin/git-pull-request | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/bin/git-pull-request b/bin/git-pull-request index 5dfd6aa7c..4a9a561ba 100755 --- a/bin/git-pull-request +++ b/bin/git-pull-request @@ -39,10 +39,11 @@ fi test -z "$user" && abort "git config user.email required" # personal access token +# config name is personal-access-token '_' is not allowed in git config personal_access_token=$(git config git-extras.personal-access-token) -test -z "$personal_access_token" && abort "git config git-extras.personal_access_token required" +test -z "$personal_access_token" && abort "git config git-extras.personal-access-token required" # branch From 85e1c4ff0af23964dd412991fb594094790a0b55 Mon Sep 17 00:00:00 2001 From: vyas <10957095+v-y-a-s@users.noreply.github.com> Date: Wed, 5 Aug 2020 16:53:36 +0530 Subject: [PATCH 4/7] Update doc --- man/git-pull-request.1 | 37 +++++++++++++++---------------------- man/git-pull-request.html | 23 +++++++++++++++-------- man/git-pull-request.md | 9 ++++++++- 3 files changed, 38 insertions(+), 31 deletions(-) diff --git a/man/git-pull-request.1 b/man/git-pull-request.1 index 2d8190e9a..cba668dcd 100644 --- a/man/git-pull-request.1 +++ b/man/git-pull-request.1 @@ -1,30 +1,28 @@ -.\" generated with Ronn/v0.7.3 -.\" http://github.com/rtomayko/ronn/tree/0.7.3 -. -.TH "GIT\-PULL\-REQUEST" "1" "November 2017" "" "Git Extras" -. +.\" generated with Ronn-NG/v0.8.0 +.\" http://github.com/apjanke/ronn-ng/tree/0.8.0 +.TH "GIT\-PULL\-REQUEST" "1" "August 2020" "" "Git Extras" .SH "NAME" \fBgit\-pull\-request\fR \- Create pull request for GitHub project -. .SH "SYNOPSIS" \fBgit\-pull\-request\fR [] -. .SH "DESCRIPTION" Create pull request for a project on GitHub via command line\. -. .P Uses the email from \fBgit config user\.email\fR to open the pull request\. -. +.P +Personal access token is required for making API call to open the pull request\. +.P +Makre sure the personal access token has the right \fBOAuth\fR scopes for the repo(s) +.P +use \fBgit config \-\-global \-\-add git\-extras\.personal\-access\-token \fR +.P +if using mutiple accounts, override the global value in the specific repo using \fBgit config git\-extras\.personal\-access\-token \fR .SH "OPTIONS" -. .P The target branch you want to send pull request to\. -. .SH "EXAMPLES" -. .nf - $ git pull\-request master Everything up\-to\-date @@ -35,16 +33,11 @@ Everything up\-to\-date base [master]: GitHub two\-factor authentication code (leave blank if not set up): -Enter host password for user \'spacewanderlzx@gmail\.com\': -\.\.\. -. +\|\.\|\.\|\. .fi -. .SH "AUTHOR" -Written by Tj Holowaychuk <\fItj@vision\-media\.ca\fR> -. +Written by Tj Holowaychuk <\fI\%mailto:tj@vision\-media\.ca\fR> .SH "REPORTING BUGS" -<\fIhttps://github\.com/tj/git\-extras/issues\fR> -. +<\fI\%https://github\.com/tj/git\-extras/issues\fR> .SH "SEE ALSO" -<\fIhttps://github\.com/tj/git\-extras\fR> +<\fI\%https://github\.com/tj/git\-extras\fR> diff --git a/man/git-pull-request.html b/man/git-pull-request.html index 0eba0c93c..17f069cc2 100644 --- a/man/git-pull-request.html +++ b/man/git-pull-request.html @@ -1,8 +1,8 @@ - - + + git-pull-request(1) - Create pull request for GitHub project