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.
This commit is contained in:
OrangePi CM5 Builder 2026-04-09 22:05:31 +08:00
parent 2a0e5c9f07
commit 0f4917bd56
1 changed files with 6 additions and 1 deletions

View File

@ -362,7 +362,12 @@ fetch_from_github_archive()
[[ -n $ref_name ]] || return 1 [[ -n $ref_name ]] || return 1
local base=${upstream_url%.git} 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 archive_dir="${EXTER}/cache/sources/.github-archives"
local tar_path="${archive_dir}/$(basename "${base}")-${ref_name}.tar.gz" local tar_path="${archive_dir}/$(basename "${base}")-${ref_name}.tar.gz"
local tar_part="${tar_path}.part" local tar_part="${tar_path}.part"