Github API: get commit statistics for all branches - github

I'm trying to use Github's API to get statistics for a branch that has multiple active branches. As far as I can tell, though, the API only gives results from the default branch. Is there a way to get those statistics from across branches?

Related

How to fetch all stale branches on a GitHub repo?

I know there's a GET /repos/{owner}/{repo}/branches API for listing branches.
Is there one for stale branches? Or is it possible to select the stale branches from those returned by the list branches API?

How do I track a public repository/ organisation's progress on Github?

I want to track some projects hosted publicly on GitHub by others and export metrics such as the number of commits, pr merges, and issues resolved to a CSV document periodically.
I've read the GitHub docs to figure out a way to use the API to extract data, but as per my understanding, the API is for tracking projects hosted by the owner only. Any help?

GitHub API - Equivalent of GitLab's Protected branch API

There is a feature named Protected branches API on GitLab API. Basically, you can restrict all the push and merge access by setting their levels to 0.
I have checked Branches section on GitHub REST API document but I couldn't find the equivalent API. How can I restrict merge and push to a branch on GitHub? Also, I want to remove this restriction after some operations.
protect master branch (do not allow any push, merge etc.)
do something
unprotect master branch
Going to the github api documentation, I see they have added protections. This seems pretty clear how to add proctections using API now.
I don't know a way using the API, but in the UI, you can go to settings > branches and then add some protection rules
You can read more about it here

get historical languages data from GitHub API

I want to make a timeline for the usage of different languages in my private repositories. The GitHub API provides the bytes of data in each language with GET /repos/:owner/:repo/languages
as well as the meta data on each commit with GET /repos/:owner/:repo/commits/:sha which doesn't have a 'languages' attribute.
The brute-force idea is to clone my repositories and measure it myself at each commit from the history of commits. But I was wondering if there is a smarter way to do so.

GitHub REST API: Commits per release

I'm trying to obtain the commits that were included on an specific release, on a repository that uses tags to identify releases. According to this answer, this doable through git log.
However, I need to gather this information for several repositories, so using an API is more convenient. Is it possible to get that information from GitHub's REST API?
You can use the compare two commits API:
GET /repos/:owner/:repo/compare/:base...:head
This is the same as locally running git log base..head.
Given that you want to automate this for several repos check List your Repositories API as well
Let me know if you need more info.