mirror of
https://github.com/cargo-bins/cargo-binstall.git
synced 2025-04-24 22:30:03 +00:00
Read from env GH_TOKEN
for github_token as a fallback (#883)
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
This commit is contained in:
parent
ff5276f4f4
commit
3e0d7363a5
1 changed files with 8 additions and 4 deletions
|
@ -461,11 +461,15 @@ You cannot use --{option} and specify multiple packages at the same time. Do one
|
||||||
.exit()
|
.exit()
|
||||||
}
|
}
|
||||||
|
|
||||||
if opts.github_token.is_none() && !opts.no_discover_github_token {
|
if opts.github_token.is_none() {
|
||||||
if let Some(github_token) = try_extract_from_git_credentials() {
|
if let Ok(github_token) = env::var("GH_TOKEN") {
|
||||||
opts.github_token = Some(github_token);
|
|
||||||
} else if let Ok(github_token) = gh_token::get() {
|
|
||||||
opts.github_token = Some(github_token.into());
|
opts.github_token = Some(github_token.into());
|
||||||
|
} else if !opts.no_discover_github_token {
|
||||||
|
if let Some(github_token) = try_extract_from_git_credentials() {
|
||||||
|
opts.github_token = Some(github_token);
|
||||||
|
} else if let Ok(github_token) = gh_token::get() {
|
||||||
|
opts.github_token = Some(github_token.into());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue