mirror of
https://github.com/cargo-bins/cargo-binstall.git
synced 2025-04-24 22:30:03 +00:00
CI: Fix binstalk-git-repo-api on PR of forks (#1932)
* Rm CI_UNIT_TEST_GITHUB_TOKEN fallback for unit-tests As it would break unit testing Signed-off-by: Jiahao XU <30436523+NobodyXu@users.noreply.github.com> * CI: Fix gh_api_client.rs test Ignore empty gh token Signed-off-by: Jiahao XU <30436523+NobodyXu@users.noreply.github.com> * Update crates/binstalk-git-repo-api/src/gh_api_client.rs Signed-off-by: Jiahao XU <30436523+NobodyXu@users.noreply.github.com> * Update crates/binstalk-git-repo-api/src/gh_api_client.rs Signed-off-by: Jiahao XU <30436523+NobodyXu@users.noreply.github.com> --------- Signed-off-by: Jiahao XU <30436523+NobodyXu@users.noreply.github.com>
This commit is contained in:
parent
a8227ae6a4
commit
61c9231401
2 changed files with 7 additions and 5 deletions
2
.github/workflows/ci.yml
vendored
2
.github/workflows/ci.yml
vendored
|
@ -95,7 +95,7 @@ jobs:
|
||||||
if: env.CARGO_NEXTEST_ADDITIONAL_ARGS != ''
|
if: env.CARGO_NEXTEST_ADDITIONAL_ARGS != ''
|
||||||
env:
|
env:
|
||||||
GITHUB_TOKEN: ${{ secrets.CI_TEST_GITHUB_TOKEN || secrets.GITHUB_TOKEN }}
|
GITHUB_TOKEN: ${{ secrets.CI_TEST_GITHUB_TOKEN || secrets.GITHUB_TOKEN }}
|
||||||
CI_UNIT_TEST_GITHUB_TOKEN: ${{ secrets.CI_UNIT_TEST_GITHUB_TOKEN || secrets.GITHUB_TOKEN }}
|
CI_UNIT_TEST_GITHUB_TOKEN: ${{ secrets.CI_UNIT_TEST_GITHUB_TOKEN }}
|
||||||
|
|
||||||
e2e-tests:
|
e2e-tests:
|
||||||
if: github.event_name != 'pull_request'
|
if: github.event_name != 'pull_request'
|
||||||
|
|
|
@ -527,10 +527,12 @@ mod test {
|
||||||
fn create_client() -> Vec<GhApiClient> {
|
fn create_client() -> Vec<GhApiClient> {
|
||||||
let client = create_remote_client();
|
let client = create_remote_client();
|
||||||
|
|
||||||
let auth_token = env::var("CI_UNIT_TEST_GITHUB_TOKEN")
|
let auth_token = match env::var("CI_UNIT_TEST_GITHUB_TOKEN") {
|
||||||
.ok()
|
Ok(auth_token) if !auth_token.is_empty() => {
|
||||||
.map(Box::<str>::from)
|
Some(zeroize::Zeroizing::new(auth_token.into_boxed_str()))
|
||||||
.map(zeroize::Zeroizing::new);
|
}
|
||||||
|
_ => None,
|
||||||
|
};
|
||||||
|
|
||||||
let gh_client = GhApiClient::new(client.clone(), auth_token.clone());
|
let gh_client = GhApiClient::new(client.clone(), auth_token.clone());
|
||||||
gh_client.set_only_use_restful_api();
|
gh_client.set_only_use_restful_api();
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue