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

Replace raw file fetch with api fetch. #550

Closed
wants to merge 1 commit into from

Conversation

acrogenesis
Copy link

Hello!

I'm setting up upptime in a private repository, with a proxy for api.github.com which adds the Authorization header (will release as open-source).

The summary.json being retrieved using raw.githubusercontent.com is a challenge as the pat tokens won't work to retrieve the file.

This PR changes the requests to use ${apiBaseUrl}/repos/${owner}/${repo}/contents/history/summary.json which returns the file for any public repo and if we add the Authorization: Bearer token header for private repos.

@acrogenesis acrogenesis marked this pull request as ready for review June 25, 2024 06:34
@acrogenesis
Copy link
Author

What do you think @AnandChowdhary? or would you prefer another approach?

@AnandChowdhary
Copy link
Member

The reason I used raw.githubusercontent.com was because they don't have a rate limit as we're only accessing status resources, vs. using the GitHub API, which unauthenticated will have a very small per-minute and per-hour rate limit. Currently the workaround we've been recommending is setting up a proxy (https://upptime.js.org/docs/configuration/#custom-api-base-url), which you can also set for the userContentBaseUrl.

@acrogenesis
Copy link
Author

That makes sense, thanks

@acrogenesis acrogenesis closed this Jul 1, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants