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
# relatively restrictive rate limits for unauthenticated users.
url =
let
endpoint = "/repos/${owner}/${repo}/tarball/${revWithTag}";
in
if private
then
if githubBase == "github.com"
then "https://api.github.com${endpoint}"
else "https://${githubBase}/api/v3${endpoint}"
else "${baseUrl}/archive/${revWithTag}.tar.gz";
if private then
let
endpoint = "/repos/${owner}/${repo}/tarball/${revWithTag}";
in
if githubBase == "github.com" then
"https://api.github.com${endpoint}"
else
"https://${githubBase}/api/v3${endpoint}"
else
"${baseUrl}/archive/${revWithTag}.tar.gz";
extension = "tar.gz";
passthru = {