Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(github): use api.github.com for private repository support #93

Merged
merged 5 commits into from
Oct 4, 2023

Conversation

ishanjain28
Copy link
Contributor

Hey,

So far this project uses the url

https://github.com/<owner>/<repo>/archive/<ref>.tar.gz

This url does not work for private repositories since Github returns 404 response.

I have changed this url to,

https://api.github.com/repos/<owner>/<repo>/tarball/<ref>

This url can be used for public repositories(without a token) and private repositories with a token and it receives a tarball in response same as before.

@pi0 pi0 changed the title bugfix: Corrected provider for downloading github repositories fix(github): use api.github.com for private repository support Oct 4, 2023
@pi0
Copy link
Member

pi0 commented Oct 4, 2023

Thanks for your pull request and sorry took longer than expected to review.

It is strange because "archives" API was supported previously. It seems a silent breaking change on the GitHub side.

I have made a few changes to comply with github API docs (using Bearer) also URL normalization (also verified locally)

My guess is that this is probably going to break GitHub enterprise users (if any) and there are no clear docs about custom domain examples. Added a TODO comment to try a free trial and verify but I guess public GitHub fix is worth moving this forward earlier 👍🏼

@codecov
Copy link

codecov bot commented Oct 4, 2023

Codecov Report

Merging #93 (3b5f380) into main (9704865) will increase coverage by 0.98%.
The diff coverage is 100.00%.

@@            Coverage Diff             @@
##             main      #93      +/-   ##
==========================================
+ Coverage   71.06%   72.04%   +0.98%     
==========================================
  Files           6        6              
  Lines         432      440       +8     
  Branches       41       43       +2     
==========================================
+ Hits          307      317      +10     
+ Misses        125      123       -2     
Files Coverage Δ
src/providers.ts 51.31% <100.00%> (+5.72%) ⬆️

... and 1 file with indirect coverage changes

@pi0 pi0 merged commit 3d77e59 into unjs:main Oct 4, 2023
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants