Repository navigation
Fork mode: finding the fork costs the fork token 2+ requests per repository, every run #46513
Unanswered
mbarbero
asked this question in
Request Help
Replies: 1 comment
|
Any thoughts? I am aiming to follow the contributing guidelines by starting a discussion before submitting a PR, though I am open to a PR if maintainers prefer to discuss over some code. Thank you! |
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
How are you running Renovate?
Self-hosted Renovate CLI
Which platform you running Renovate on?
GitHub.com
Which version of Renovate are you using?
44.115.10
Please tell us more about your question or problem
I run Renovate in fork mode across many orgs.
tokenis a GitHub App installation token (one per org).forkTokenis a classic PAT of one bot user that owns all the forks. Each org's installation has its own budget of at least 5,000 requests/hour, but the fork token is one user's 5,000/hour, shared by every repository in every org.In fork mode,
initRepocallsfindFork(forkToken, repository, forkOrg)for every repository on every run, even when there is nothing to update:listForkslists the upstream repository's forks with the fork token, 100 per page and up to 100 pages. A heavily forked repository can cost up to 100 requests.forkOrg,getUserDetails(…, forkToken)callsGET /userto get the bot's login. The result isn't reused, so this happens once per repository.So the fork token pays at least 2 REST requests per repository per run before any real work. With ~4,000 repositories checked hourly, that's at least 8,000 requests/hour against a 5,000/hour budget, while each org's installation budget stays mostly unused. (Clone, fetch and push also use the fork token, but git traffic isn't counted in the REST budget.)
createForknames them<owner>-_-<repo>, soGET /repos/<forkOwner>/<owner>-_-<repo>(checkingparent.full_name) finds the fork in one request however many forks exist, falling back to listing forks when it isn't there.With 1 and 2, a run with nothing to update makes no REST requests with the fork token at all. It is then only used for git, creating forks, and creating or updating PRs.
No config change. Behavior is identical when
tokenandforkTokenare the same PAT.Related: #39263 (future of fork mode). I'm happy to open a PR for 1 and 2, and 3 if you think it's worth it.
Logs (if relevant)
No response
All reactions