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

Pass GitHub access token when accessing raw.githubusercontent.com in case of private recipes #842

Merged

Conversation

aivus
Copy link
Contributor

@aivus aivus commented Dec 1, 2021

I'm checking how to use private symfony recipes and found that symfony/flex is not using GH access token when accessing raw.githubcontent.com.

For a public repositories it's not a case, but for private repositories it's not possible to access the recipe template url from raw.githubcontent.com without using access token.

Adding access token for requests to api.github.com is covered by Composer, but it doesn't cover downloading files from raw.githubcontent.com.

This PR introduces logic for adding token for requests to raw.githubcontent.com in the similar way as composer does for api.github.com.

Limitations:

  • Current implementation adds the token (if it presents) to ALL requests to the raw.githubusercontent.com, but I don't think that it's a big issue actually.

@nicolas-grekas
Copy link
Member

Why don't you use api.github.com for private recipes?

@aivus
Copy link
Contributor Author

aivus commented Dec 2, 2021

2 points here:

@stof
Copy link
Member

stof commented Dec 2, 2021

Passing the token solves the rate limiting problem (as the rate limit is much higher for authenticated requests: https://docs.github.com/en/rest/overview/resources-in-the-rest-api#rate-limiting)

@aivus
Copy link
Contributor Author

aivus commented Jan 11, 2022

Ok, let's close this PR then as after forking recipes-checker and reverting changes to use api.github.com it works fine for private repos.

My idea initially was to use original recipes-checker for own private/public repos, but it seems some changes are required on checker side besides URLs.

@aivus aivus closed this Jan 11, 2022
@nicolas-grekas
Copy link
Member

nicolas-grekas commented Jan 11, 2022

I'd be happy to make the recipe-checker a bit more generic if you're up for a PR.

@nicolas-grekas
Copy link
Member

Thank you @aivus.

@nicolas-grekas nicolas-grekas merged commit 988b39c into symfony:1.x Feb 16, 2022
@aivus aivus deleted the add-access-token-to-raw-gh-requests branch January 9, 2024 14:55
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

3 participants