From d291b2775c5f640bdfa1513c24ab146ebff453dc Mon Sep 17 00:00:00 2001 From: Guilhem Saurel Date: Sat, 16 Nov 2024 19:33:26 +0100 Subject: [PATCH] =?UTF-8?q?Support=20`GITHUB=5FTOKEN`=C2=A0var=20for=20`gi?= =?UTF-8?q?t-fork`=20and=20`git-pull-request`=20(#1177)?= 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 | 4 ++-- bin/git-pull-request | 4 ++-- man/git-fork.1 | 2 +- man/git-fork.html | 2 +- man/git-fork.md | 2 +- man/git-pull-request.1 | 2 +- man/git-pull-request.html | 8 ++++---- man/git-pull-request.md | 2 +- 8 files changed, 13 insertions(+), 13 deletions(-) diff --git a/bin/git-fork b/bin/git-fork index ba85283f6..3d3742fd4 100755 --- a/bin/git-fork +++ b/bin/git-fork @@ -17,9 +17,9 @@ read -r user # personal access token # config name is github-personal-access-token '_' is not allowed in git config -github_personal_access_token=$(git config git-extras.github-personal-access-token) +github_personal_access_token=$(git config --default "$GITHUB_TOKEN" git-extras.github-personal-access-token) -test -z "$github_personal_access_token" && abort "git config git-extras.github-personal-access-token required" +test -z "$github_personal_access_token" && abort "GITHUB_TOKEN, or git config git-extras.github-personal-access-token required" # extract owner + project from repo url project=${url##*/} diff --git a/bin/git-pull-request b/bin/git-pull-request index 5787da147..3bd2060ee 100755 --- a/bin/git-pull-request +++ b/bin/git-pull-request @@ -31,9 +31,9 @@ EOF # personal access token # config name is github-personal-access-token '_' is not allowed in git config -github_personal_access_token=$(git config git-extras.github-personal-access-token) +github_personal_access_token=$(git config --default "$GITHUB_TOKEN" git-extras.github-personal-access-token) -test -z "$github_personal_access_token" && abort "git config git-extras.github-personal-access-token required" +test -z "$github_personal_access_token" && abort "GITHUB_TOKEN or git config git-extras.github-personal-access-token required" # branch 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 diff --git a/man/git-fork.html b/man/git-fork.html index 3ad0fbf5a..cba625a3e 100644 --- a/man/git-fork.html +++ b/man/git-fork.html @@ -105,7 +105,7 @@

DESCRIPTION

Make sure the personal access token has the right OAuth scopes for the repo(s)

-

Use git config --global --add git-extras.github-personal-access-token <your-personal-access-token>

+

Use GITHUB_TOKEN environment variable, or git config --global --add git-extras.github-personal-access-token <your-personal-access-token>

If using multiple accounts, override the global value in the specific repo using git config git-extras.github-personal-access-token <other-acc-personal-access-token>

diff --git a/man/git-fork.md b/man/git-fork.md index 701ac87a9..ace3ffdff 100644 --- a/man/git-fork.md +++ b/man/git-fork.md @@ -27,7 +27,7 @@ git-fork(1) -- Fork a repo on github Make sure the personal access token has the right `OAuth` scopes for the repo(s) - Use `git config --global --add git-extras.github-personal-access-token ` + Use `GITHUB_TOKEN` environment variable, or `git config --global --add git-extras.github-personal-access-token ` If using multiple accounts, override the global value in the specific repo using `git config git-extras.github-personal-access-token ` diff --git a/man/git-pull-request.1 b/man/git-pull-request.1 index b44859c45..3d8981c00 100644 --- a/man/git-pull-request.1 +++ b/man/git-pull-request.1 @@ -19,7 +19,7 @@ A personal access token is required for making the API call to open the pull req 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 diff --git a/man/git-pull-request.html b/man/git-pull-request.html index fa5796e10..58f280e13 100644 --- a/man/git-pull-request.html +++ b/man/git-pull-request.html @@ -86,7 +86,7 @@

DESCRIPTION

Make sure the personal access token has the right OAuth scopes for the repo(s)

-

Use git config --global --add git-extras.github-personal-access-token <your-personal-access-token>

+

Use GITHUB_TOKEN environment variable, or git config --global --add git-extras.github-personal-access-token <your-personal-access-token>

If using multiple accounts, override the global value in the specific repo using git config git-extras.github-personal-access-token <other-acc-personal-access-token>

@@ -104,9 +104,9 @@

EXAMPLES

create pull-request for spacewander/spacewander-toolbox 'master' title: test - body: - base [master]: - GitHub two-factor authentication code (leave blank if not set up): + body: + base [master]: + GitHub two-factor authentication code (leave blank if not set up): ... diff --git a/man/git-pull-request.md b/man/git-pull-request.md index 8c1489b9d..9b40d9e77 100644 --- a/man/git-pull-request.md +++ b/man/git-pull-request.md @@ -13,7 +13,7 @@ A personal access token is required for making the API call to open the pull req Make sure the personal access token has the right `OAuth` scopes for the repo(s) -Use `git config --global --add git-extras.github-personal-access-token ` +Use `GITHUB_TOKEN` environment variable, or `git config --global --add git-extras.github-personal-access-token ` If using multiple accounts, override the global value in the specific repo using `git config git-extras.github-personal-access-token `