From 0f4917bd560173f864322ff8602414c5ddea9262 Mon Sep 17 00:00:00 2001 From: OrangePi CM5 Builder Date: Thu, 9 Apr 2026 22:05:31 +0800 Subject: [PATCH] build: use codeload for GitHub archive fallback Switch archive tarball URL to codeload.github.com, which is typically more reliable than github.com/archive on flaky networks. --- scripts/general.sh | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/scripts/general.sh b/scripts/general.sh index 1fc6b974d3c7..7fc597b775de 100755 --- a/scripts/general.sh +++ b/scripts/general.sh @@ -362,7 +362,12 @@ fetch_from_github_archive() [[ -n $ref_name ]] || return 1 local base=${upstream_url%.git} - local tar_url="${base}/archive/refs/heads/${ref_name}.tar.gz" + local gh_path=${base#https://github.com/} + local gh_owner=${gh_path%%/*} + local gh_repo=${gh_path#*/} + gh_repo=${gh_repo%%/*} + # Prefer codeload endpoint; it is often more reliable than github.com/archive. + local tar_url="https://codeload.github.com/${gh_owner}/${gh_repo}/tar.gz/refs/heads/${ref_name}" local archive_dir="${EXTER}/cache/sources/.github-archives" local tar_path="${archive_dir}/$(basename "${base}")-${ref_name}.tar.gz" local tar_part="${tar_path}.part"