From 4ecb4c85e749b3ecfa4e6d98014613a416c39c97 Mon Sep 17 00:00:00 2001 From: Ludovic Marie <136255825+ludovic111@users.noreply.github.com> Date: Tue, 13 Oct 2026 20:46:36 +0200 Subject: [PATCH] Launcher: use HORIZON_GITHUB_TOKEN for GitHub's API when given; CI passes its own Shared CI runners hit GitHub's anonymous rate limit in the smoke test (launcher 0.1.2's macOS build failed twice on it). Players never set the variable, so nothing changes for them. Co-Authored-By: Claude Opus 5.5 --- .github/workflows/launcher.yml | 1 + launcher/src/backend.rs | 9 ++++++++- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/.github/workflows/launcher.yml b/.github/workflows/launcher.yml index f5157c69a..db8c5fac6 100644 --- a/.github/workflows/launcher.yml +++ b/.github/workflows/launcher.yml @@ -59,6 +59,7 @@ jobs: - name: Smoke test env: HORIZON_LAUNCHER_NO_SELF_UPDATE: '1' + HORIZON_GITHUB_TOKEN: ${{ github.token }} run: | set -euo pipefail export HORIZON_LAUNCHER_HOME="${RUNNER_TEMP//\\//}/horizon-launcher-smoke" diff --git a/launcher/src/backend.rs b/launcher/src/backend.rs index 4cb0a453f..2932a4685 100644 --- a/launcher/src/backend.rs +++ b/launcher/src/backend.rs @@ -59,7 +59,14 @@ fn agent() -> ureq::Agent { } fn get(url: &str) -> Result { - agent().get(url).call().map_err(|e| match e { + let mut request = agent().get(url); + // CI runners share addresses and hit GitHub's anonymous rate limit; they pass their own token. + if let Some(token) = std::env::var("HORIZON_GITHUB_TOKEN").ok().filter(|t| !t.is_empty()) { + if url.starts_with("https://api.github.com/") { + request = request.set("Authorization", &format!("Bearer {token}")); + } + } + request.call().map_err(|e| match e { ureq::Error::Status(403, _) => "GitHub's rate limit was reached. Try again in a few minutes.".into(), ureq::Error::Status(code, _) => format!("{url} answered {code}"), ureq::Error::Transport(t) => format!("No connection: {t}"),