mirror of
https://github.com/rust-unofficial/awesome-rust
synced 2024-11-16 06:12:56 +00:00
Fix no-username downloading
This commit is contained in:
parent
a2d783ef80
commit
396b3b58b1
@ -158,9 +158,12 @@ async fn get_stars(github_url: &str) -> u32 {
|
|||||||
let rewritten = GITHUB_REPO_REGEX.replace_all(&github_url, "https://api.github.com/repos/$org/$repo").to_string();
|
let rewritten = GITHUB_REPO_REGEX.replace_all(&github_url, "https://api.github.com/repos/$org/$repo").to_string();
|
||||||
let mut req = CLIENT
|
let mut req = CLIENT
|
||||||
.get(&rewritten);
|
.get(&rewritten);
|
||||||
let username = env::var("GITHUB_USERNAME").expect("Missing GITHUB_USERNAME");
|
if let Ok(username) = env::var("GITHUB_USERNAME") {
|
||||||
let password = env::var("GITHUB_TOKEN").expect("Missing GITHUB_TOKEN");
|
if let Ok(password) = env::var("GITHUB_TOKEN") {
|
||||||
req = req.basic_auth(username, Some(password));
|
// needs a token with at least public_repo scope
|
||||||
|
req = req.basic_auth(username, Some(password));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
let resp = req.send().await;
|
let resp = req.send().await;
|
||||||
match resp {
|
match resp {
|
||||||
|
Loading…
Reference in New Issue
Block a user