diff --git a/.github/workflows/approve.yml b/.github/workflows/approve.yml index 2e22527..6d8da85 100644 --- a/.github/workflows/approve.yml +++ b/.github/workflows/approve.yml @@ -11,6 +11,6 @@ jobs: - name: Automatic Approve uses: mheap/automatic-approve-action@v1.1.0 with: - token: ${{ secrets.GITHUB_TOKEN }} + token: ${{ secrets.TOKEN_FOR_GITHUB }} workflows: "rust.yml,lint.yml" dangerous_files: src/main.rs,Cargo.toml,Cargo.lock diff --git a/.github/workflows/rust.yml b/.github/workflows/rust.yml index 632ea7a..56360ec 100644 --- a/.github/workflows/rust.yml +++ b/.github/workflows/rust.yml @@ -40,5 +40,6 @@ jobs: - name: Run run: cargo run env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + USERNAME_FOR_GITHUB: ${{ secrets.USERNAME_FOR_GITHUB }} + TOKEN_FOR_GITHUB: ${{ secrets.TOKEN_FOR_GITHUB }} RUST_LOG: warn diff --git a/src/bin/hacktoberfest.rs b/src/bin/hacktoberfest.rs index d97bd0a..33761b1 100644 --- a/src/bin/hacktoberfest.rs +++ b/src/bin/hacktoberfest.rs @@ -87,8 +87,8 @@ async fn get_hacktoberfest_core(github_url: String) -> Result Option { .replace_all(&github_url, "https://api.github.com/repos/$org/$repo") .to_string(); let mut req = CLIENT.get(&rewritten); - if let Ok(username) = env::var("GITHUB_USERNAME") { - if let Ok(password) = env::var("GITHUB_TOKEN") { + if let Ok(username) = env::var("USERNAME_FOR_GITHUB") { + if let Ok(password) = env::var("TOKEN_FOR_GITHUB") { // needs a token with at least public_repo scope req = req.basic_auth(username, Some(password)); } @@ -243,7 +243,7 @@ fn get_url_core(url: String) -> BoxFuture<'static, (String, Result<(), CheckerEr let mut res = Err(CheckerError::NotTried); for _ in 0..5u8 { debug!("Running {}", url); - if env::var("GITHUB_USERNAME").is_ok() && env::var("GITHUB_TOKEN").is_ok() && GITHUB_REPO_REGEX.is_match(&url) { + if env::var("USERNAME_FOR_GITHUB").is_ok() && env::var("TOKEN_FOR_GITHUB").is_ok() && GITHUB_REPO_REGEX.is_match(&url) { let rewritten = GITHUB_REPO_REGEX.replace_all(&url, "https://api.github.com/repos/$org/$repo"); info!("Replacing {} with {} to workaround rate limits on Github", url, rewritten); let (_new_url, res) = get_url_core(rewritten.to_string()).await; @@ -254,8 +254,8 @@ fn get_url_core(url: String) -> BoxFuture<'static, (String, Result<(), CheckerEr .header(header::ACCEPT, "image/svg+xml, text/html, */*;q=0.8"); if GITHUB_API_REGEX.is_match(&url) { - if let Ok(username) = env::var("GITHUB_USERNAME") { - if let Ok(password) = env::var("GITHUB_TOKEN") { + if let Ok(username) = env::var("USERNAME_FOR_GITHUB") { + if let Ok(password) = env::var("TOKEN_FOR_GITHUB") { // needs a token with at least public_repo scope info!("Using basic auth for {}", url); req = req.basic_auth(username, Some(password));