I’ve come across this stackoverflow question (and answer), and was wondering if and how can this be done using GitHub API.
What I need is to tell the immediate parent branch (if any) of a push, and all the data that is available to me is what I receive in a push event payload.
Performance is critical here, so unless absolutely necessary, try to keep API requests that may return large volumes of data (i.e. all branches of a repository - for some projects this may add up to a couple of thousands, apparently) at a minimum.
Of course, the best thing to do would be to add this field in the payload, and the next best thing (or maybe it would be a last resort?) would be to run a git request over HTTPS that returns the log then parse it in code (doing what the stackoverflow answer suggests), but is it possible to run such a command on a repository that I don’t own, given it installed my GitHubApp? Are the installation credentials enough?
Any point to the best solution will be welcomed.