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] 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 8a0ad03..573d30b 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"