Is possible to enumerate number of commits to each repository in a certain branch? Ej. Linux Kernel Repository: In master branch: 420,000 commits
Well, I'm not really sure tbh, I haven't seen it passed along with data returned by the API, if it isn't possible I'll update later.
@k0shk0sh Here you go.
JSON: https://api.github.com/repos/k0shk0sh/FastHub/stats/participation
Docs: https://developer.github.com/v3/repos/statistics
@kutsan thanks buddy :)
@kutsan this is weekly commits count and not over all, however even if we use https://api.github.com/repos/k0shk0sh/fasthub/stats/contributors still the count is incorrect comparing to the GitHub commit count in Github repo. this will be in preview until we figure out a way of doing it.
I thought you can sum all of them but you are right. Seems like they contain only 52 weeks.
@kutsan even this https://api.github.com/repos/k0shk0sh/fasthub/stats/commit_activity doesn't help, and I found something weird, if you to write FastHub there will be nothing to show, only when you use small case then it'll work :D
Why they just not serve all informations about that repo under URL like repos/k0shk0sh/fasthub/stats/. So, the only way get that count, fetch the HTML URL as XML and parse, get commits count?
@kutsan because it's GitHub 馃榿
Okay, I found the "only" way to get total number of commits but little expensive, not sure is it worth though.
Here it is:
https://api.github.com/repos/k0shk0sh/FastHub/commits?per_page=100&page=1
https://api.github.com/repos/k0shk0sh/FastHub/commits?per_page=100&page=2
https://api.github.com/repos/k0shk0sh/FastHub/commits?per_page=100&page=3
... then, sum of length of array.
Yeah, a lot of HTTP request. Can't imagine what will happen for 1K+ commits. And probably, we need cloud functions for that. Otherwise not gonna happen.
And as I said the other way, fetching https://github.com/k0shk0sh/FastHub link as HTML and then Regex search \d+\scommits something like that, more hack-ish but not so expensive.
I guess, the latter is better, not to expensive. but then, I haven't decide yet to do sniffing :D
@kutsan alright we might be able to do it via search commits api, but its in preview so we just do it and if it breaks its okay I guess. Not a big deal.
-- this is invalid & doesn't work lol
We finally found the real answer and this is single request only.
Just make a HTTP GET request to this link https://api.github.com/repos/k0shk0sh/FastHub/commits?per_page=1 or your repository and you need to see HTTP response headers. See Link field, second link's page= property gives you the last page which is total number of commits.

this issued fixed by this commit 8e8baca
Most helpful comment
We finally found the real answer and this is single request only.
Just make a HTTP GET request to this link
https://api.github.com/repos/k0shk0sh/FastHub/commits?per_page=1or your repository and you need to see HTTP response headers. SeeLinkfield, second link'spage=property gives you the last page which is total number of commits.