fetchFromGitHub: refactor for scope clarity

Co-authored-by: Philip Taron <philip.taron@gmail.com>
This commit is contained in:
Adam Dinwoodie 2025-01-16 10:45:57 +00:00 committed by GitHub
parent 1a72fa0e19
commit 42574f5205
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -74,15 +74,16 @@ let
# Use the archive URI for non-private repos, as the API endpoint has # Use the archive URI for non-private repos, as the API endpoint has
# relatively restrictive rate limits for unauthenticated users. # relatively restrictive rate limits for unauthenticated users.
url = url =
let if private then
endpoint = "/repos/${owner}/${repo}/tarball/${revWithTag}"; let
in endpoint = "/repos/${owner}/${repo}/tarball/${revWithTag}";
if private in
then if githubBase == "github.com" then
if githubBase == "github.com" "https://api.github.com${endpoint}"
then "https://api.github.com${endpoint}" else
else "https://${githubBase}/api/v3${endpoint}" "https://${githubBase}/api/v3${endpoint}"
else "${baseUrl}/archive/${revWithTag}.tar.gz"; else
"${baseUrl}/archive/${revWithTag}.tar.gz";
extension = "tar.gz"; extension = "tar.gz";
passthru = { passthru = {