Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit9417866

Browse files
committed
expand use-cases ingh_auth
1 parentdaf03f8 commit9417866

File tree

1 file changed

+14
-12
lines changed

1 file changed

+14
-12
lines changed

‎scripts/lib.sh

Lines changed: 14 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -134,20 +134,22 @@ requiredenvs() {
134134
}
135135

136136
gh_auth() {
137-
local fail=0
138-
if [["${CODER:-}"=="true" ]];then
139-
if! output=$(coder external-auth access-token github2>&1);then
140-
log"ERROR: Could not authenticate with GitHub."
141-
log"$output"
142-
fail=1
137+
if [[-z${GITHUB_TOKEN:-} ]];then
138+
if [[-n${GH_TOKEN:-} ]];then
139+
export GITHUB_TOKEN=${GH_TOKEN}
140+
elif [[${CODER:-}==true ]];then
141+
if! output=$(coder external-auth access-token github2>&1);then
142+
# TODO(maf): We could allow checking `gh auth token` here.
143+
log"${output}"
144+
error"Could not authenticate with GitHub using Coder external auth."
145+
else
146+
export GITHUB_TOKEN=${output}
147+
fi
148+
elif token="$(gh auth token --hostname github.com2>/dev/null)";then
149+
export GITHUB_TOKEN=${token}
143150
else
144-
GITHUB_TOKEN=$(coder external-auth access-token github)
145-
export GITHUB_TOKEN
151+
error"GitHub authentication is required to run this command, please set GITHUB_TOKEN or authenticate run 'gh auth login'."
146152
fi
147-
elif token="$(gh auth token --hostname github.com2>/dev/null)";then
148-
export GITHUB_TOKEN=$token
149-
else
150-
log"Please authenticate gh CLI by running 'gh auth login'"
151153
fi
152154
}
153155

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp