-
Notifications
You must be signed in to change notification settings - Fork 566
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
Add support for locally hosted GHES instances to reduce rate limiting #720
base: main
Are you sure you want to change the base?
Conversation
Guidance + suggestions are welcome! |
@e-korolevskii @dmitry-shibanov This also affects a GHE instance I use. |
@@ -10957,10 +10957,10 @@ function findAllVersions(toolName, arch) { | |||
return versions; | |||
} | |||
exports.findAllVersions = findAllVersions; | |||
function getManifestFromRepo(owner, repo, auth, branch = 'master') { | |||
function getManifestFromRepo(owner, repo, auth, branch = 'master', serverUrl = 'https://api.github.com') { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
getManifestFromRepo()
is a function from a library imported at the top of src/install-python.ts
. The code here in dist/*
is generated from that library at compile time, so your changes will be overwritten.
For reference, here is the source of the library function. If you truly intend to reuse the library function you'll first need to merge a PR changing its signature here.
In order for this PR to work you need to limit your changes to the src/*.ts
files.
@@ -10,7 +10,11 @@ const AUTH = !TOKEN ? undefined : `token ${TOKEN}`; | |||
const MANIFEST_REPO_OWNER = 'actions'; | |||
const MANIFEST_REPO_NAME = 'python-versions'; | |||
const MANIFEST_REPO_BRANCH = 'main'; | |||
export const MANIFEST_URL = `https://raw.githubusercontent.com/${MANIFEST_REPO_OWNER}/${MANIFEST_REPO_NAME}/${MANIFEST_REPO_BRANCH}/versions-manifest.json`; | |||
const API_URL = core.getInput('github_api_url'); | |||
const GITHUB_API_URL = API_URL ? 'https://api.github.com' : API_URL; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
truthy and falsey expressions are backwards here, should be API_URL ? API_URL : ...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good catch
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The unit tests caught this! ;)
const API_URL = core.getInput('github_api_url'); | ||
const GITHUB_API_URL = API_URL ? 'https://api.github.com' : API_URL; | ||
const RAW_URL = core.getInput('github_raw_url'); | ||
const GITHUB_RAW_URL = RAW_URL ? 'https://raw.githubusercontent.com' : RAW_URL; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
truthy and falsey expressions are backwards here, should be RAW_URL ? RAW_URL : ...
Without any changes to |
Converted to a draft until I can work on this further |
Description:
Rate limiting, while necessary, can be frustrating to deal with. The work around is not always a viable solution. No company wants to rely solely on a single employee's GitHub.com PAT for significant internal projects.
This attempts to resolve rate limiting errors by allowing users to internally host a copy of
actions/python-versions
and specify their GHES api endpoint instead of the GitHub.com endpoint being hardcoded.##[error]API rate limit exceeded for YOUR_IP. (But here's the good news: Authenticated requests get a higher rate limit. Check out the documentation for more details.)
Related issue:
#683
#638
#666
#316
#443 (comment)
https://docs.github.com/en/enterprise-server/admin/github-actions/managing-access-to-actions-from-githubcom/setting-up-the-tool-cache-on-self-hosted-runners-without-internet-access
Check list: