Find the tag that comes after the commit - API call - git describe --contains

I am looking for an api call where I can get tag hash/release hash for given commit hash Id. Similar to Gitlab’s refs call: https://docs.gitlab.com/ce/api/commits.html#get-references-a-commit-is-pushed-to

Does the Github API support it somehow? I am not able to find it.

I appreciate any help you can provide.

2 Likes

My apologies for taking so long to get back to you and thank you for reaching out, The only thing you can do is fetch all the commits for a specific branch, and then iterate through the commits to see if a specific commit is in the list. To do that, make a request to /repos/:owner/:repo/commits?sha=branchname, where branch name is the name of the branch you want to fetch commits for e.g. https://api.github.com/repos/izuzak/pmrpc/commits?sha=master.

I hope this helps and if there is anything else I can do for you, just ask. I promise I’ll try to be quicker next time!

This doesn’t answer the question, as far as I can tell. I’ve looked at the payload from the mentioned Commits API, and it carries no information about the tags of the commits, or the releases on those tags.