From 3be2e2141a9e19a94e248d36479f9e46180aff00 Mon Sep 17 00:00:00 2001 From: Guilhem Saurel Date: Thu, 14 Nov 2024 11:15:37 +0100 Subject: [PATCH] use GITHUB_TOKEN: follow review advices MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: 罗泽轩 <4161644+spacewander@users.noreply.github.com> --- bin/git-fork | 6 +----- bin/git-pull-request | 6 +----- man/git-fork.1 | 2 +- 3 files changed, 3 insertions(+), 11 deletions(-) diff --git a/bin/git-fork b/bin/git-fork index 05a4841fc..3d3742fd4 100755 --- a/bin/git-fork +++ b/bin/git-fork @@ -17,11 +17,7 @@ read -r user # personal access token # config name is github-personal-access-token '_' is not allowed in git config -if test -z "${GITHUB_TOKEN}"; then - github_personal_access_token=$(git config git-extras.github-personal-access-token) -else - github_personal_access_token=$GITHUB_TOKEN -fi +github_personal_access_token=$(git config --default "$GITHUB_TOKEN" git-extras.github-personal-access-token) test -z "$github_personal_access_token" && abort "GITHUB_TOKEN, or git config git-extras.github-personal-access-token required" diff --git a/bin/git-pull-request b/bin/git-pull-request index 2730d2ee2..3bd2060ee 100755 --- a/bin/git-pull-request +++ b/bin/git-pull-request @@ -31,11 +31,7 @@ EOF # personal access token # config name is github-personal-access-token '_' is not allowed in git config -if test -z "${GITHUB_TOKEN}"; then - github_personal_access_token=$(git config git-extras.github-personal-access-token) -else - github_personal_access_token=$GITHUB_TOKEN -fi +github_personal_access_token=$(git config --default "$GITHUB_TOKEN" git-extras.github-personal-access-token) test -z "$github_personal_access_token" && abort "GITHUB_TOKEN or git config git-extras.github-personal-access-token required" diff --git a/man/git-fork.1 b/man/git-fork.1 index e259745e7..805fbf9bb 100644 --- a/man/git-fork.1 +++ b/man/git-fork.1 @@ -49,7 +49,7 @@ A personal access token is required for making the API call to create a new fork Make sure the personal access token has the right \fBOAuth\fR scopes for the repo(s) . .P -Use \fBgit config \-\-global \-\-add git\-extras\.github\-personal\-access\-token \fR +Use \fBGITHUB_TOKEN\fR environment variable, or \fBgit config \-\-global \-\-add git\-extras\.github\-personal\-access\-token \fR . .P If using multiple accounts, override the global value in the specific repo using \fBgit config git\-extras\.github\-personal\-access\-token \fR