Skip to content

Commit

Permalink
Support GITHUB_TOKEN var for git-fork and git-pull-request (#1177)
Browse files Browse the repository at this point in the history
Co-authored-by: 罗泽轩 <[email protected]>
  • Loading branch information
nim65s and spacewander authored Nov 16, 2024
1 parent fb0bc69 commit d291b27
Show file tree
Hide file tree
Showing 8 changed files with 13 additions and 13 deletions.
4 changes: 2 additions & 2 deletions bin/git-fork
Original file line number Diff line number Diff line change
Expand Up @@ -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##*/}
Expand Down
4 changes: 2 additions & 2 deletions bin/git-pull-request
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
2 changes: 1 addition & 1 deletion man/git-fork.1
Original file line number Diff line number Diff line change
Expand Up @@ -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 <your\-personal\-access\-token>\fR
Use \fBGITHUB_TOKEN\fR environment variable, or \fBgit config \-\-global \-\-add git\-extras\.github\-personal\-access\-token <your\-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 <other\-acc\-personal\-access\-token>\fR
Expand Down
2 changes: 1 addition & 1 deletion man/git-fork.html

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion man/git-fork.md
Original file line number Diff line number Diff line change
Expand Up @@ -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 <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>`

Expand Down
2 changes: 1 addition & 1 deletion man/git-pull-request.1
Original file line number Diff line number Diff line change
Expand Up @@ -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 <your\-personal\-access\-token>\fR
Use \fBGITHUB_TOKEN\fR environment variable, or \fBgit config \-\-global \-\-add git\-extras\.github\-personal\-access\-token <your\-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 <other\-acc\-personal\-access\-token>\fR
Expand Down
8 changes: 4 additions & 4 deletions man/git-pull-request.html

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion man/git-pull-request.md
Original file line number Diff line number Diff line change
Expand Up @@ -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 <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>`

Expand Down

0 comments on commit d291b27

Please sign in to comment.