Is there a way to efficiently get the amount of all different contributors of a GitHub repository using the GitHub API?
I mean, without necessarily getting all the contributor objects and manually count the total amount.
Yes, the trick is to request the list of contributors with one item per page. But include anon=true as a query param to include anonymous contributors as well
https://api.github.com/repos/:owner/:repo/contributors?per_page=1&anon=true
And in the response header (like it was mentioned in the previous answer), look for the Link property and get the value just before rel="last"
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With