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