Authenticate requests to /release page with GITHUB_TOKEN in CI

This commit is contained in:
Felix Schütt
2022-11-18 17:34:17 +01:00
parent 71563bc21f
commit db299b895d
2 changed files with 11 additions and 2 deletions

View File

@@ -214,6 +214,7 @@ jobs:
TARGET_DIR: target/${{ matrix.target }}/release
CARGO_TARGET: --target ${{ matrix.target }}
WAPM_DEV_TOKEN: ${{ secrets.WAPM_DEV_TOKEN }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
#- name: Test integration CLI
# if: matrix.run_test && matrix.os == 'windows-2019'

View File

@@ -1370,8 +1370,16 @@ mod http_fetch {
let mut writer = Vec::new();
let uri = Uri::try_from("https://api.github.com/repos/wasmerio/wasmer/releases").unwrap();
let response = Request::new(&uri)
.header("User-Agent", "wasmer")
// Increases rate-limiting in GitHub CI
let auth = std::env::var("GITHUB_TOKEN");
let mut response = Request::new(&uri);
if let Ok(token) = auth {
response.header("Authorization", &format!("Bearer {token}"));
}
let response = response
.header("User-Agent", "wasmerio")
.header("Accept", "application/vnd.github.v3+json")
.timeout(Some(std::time::Duration::new(30, 0)))
.send(&mut writer)