Skip to content

Commit

Permalink
Authenticate requests to /release page with GITHUB_TOKEN in CI
Browse files Browse the repository at this point in the history
  • Loading branch information
fschutt committed Nov 18, 2022
1 parent 71563bc commit db299b8
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 deletions.
1 change: 1 addition & 0 deletions .github/workflows/test-sys.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand Down
12 changes: 10 additions & 2 deletions lib/cli/src/commands/create_exe.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit db299b8

Please sign in to comment.