forked
forked copied to clipboard
Doesn't find all forks
This is a great tool. However, does it actually list all forks? I went to: http://forked.yannick.io/dfabulich/choicescript
I noticed I am not in the list: https://github.com/Flurrywinde/choicescript
Also, recently I saw another fork made an update, but that fork was also not in this list: https://github.com/ldarren/choicescript/commits/master
While I can't comment for certain (as I don't have much experience with Ruby/Octokit) I have a pretty good idea of why this is. Typically, when using the Github REST API, sending a GET request to api.github.com/repos/:user/:repo/forks
returns the first 30 forked repositories. That's what we're seeing here.
It is possible to get all of the forks - at least using traditional means such as curl, you simply send a GET request to api.github.com/repos/:user/:repo/forks?page=2
or whichever "page" (ie group of 30 repos) you want. I'd assume Octokit has some feature to allow this...?
Here's the issue: the github API limits you to 5,000 requests per hour (at least, for OAuth apps - it could be even fewer) and each "page" you request counts against this. The API doesn't state any way to simply request all pages . . . trying to get each of these pages individually would totally break functionality. Take this example: let's say a user requested all of the forks of twbs/bootstrap
- this repository has over 50,000 forks, which would require well over 1,500 calls to the github API to list all of them. A few of these and the service is unusable for all users for the remainder of the hour.
The only option here is to ditch the REST API and use the v4 API - again, I don't really have any experience with it, so it may also limit API calls (though it's designed to be more flexible in the data requested, so I'd be surprised if you couldn't get all forks at once). Plus, I have no idea if Octokit supports using the v4 API so it might require a total overhaul of the code base.