Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Cannot get releases for a Repo with the Github API

Tags:

github-api

I am experiencing problems with the Github API when I try to get the releases for a public repo. I've made several request to /repos/:owner/:repo/releases (https://developer.github.com/v3/repos/releases/#list-releases-for-a-repository) and I'm not able to obtain the releases of a repo, except when I request for the releases of one of my repos and I had created the releases via Github API (https://developer.github.com/v3/repos/releases/#create-a-release).

For example, this GET request to the server returns an empty body and a 200 status:

https://api.github.com/repos/jquery/jquery/releases

I make the request with the Authorization header (Authorization: token {MY_TOKEN}), specifying a token mine with gist, repo and user permisions.

Can you tell me if I'm doing something wrong or what is the best approach to retrieve the releases of a repo?

Thanks!

like image 784
ailopera Avatar asked Oct 01 '14 11:10

ailopera


People also ask

How do I get my GitHub API repository?

Hitting https://api.github.com/users/USERNAME/repos will list public repositories for the user USERNAME.

How do I see releases on GitHub?

Viewing releases On GitHub.com, navigate to the main page of the repository. To the right of the list of files, click Releases. At the top of the Releases page, click Releases.


2 Answers

You cannot request non-published releases. So if the request come with an empty response body then there is no published release under that repository i.e. github.com/jquery/jquery don't have one.

In order to get a JSON feed containing a list of a (owner/repo) releases using the Github Release API endpoint "/repos/:owner/:repo/releases" there must be published releases in that repo.

This is how a published release looks like:

enter image description here

And here you can try to request a release on a repo of mine where I already published a release version: https://api.github.com/repos/wisebrains/wise-archetypes/releases

like image 66
tmarwen Avatar answered Oct 21 '22 12:10

tmarwen


In many cases there are no published releases, but you can still list tags by using GET /repos/:owner/:repo/tags endpoint.

For example:

GET https://api.github.com/repos/twigphp/twig/tags

Note that this call will only return the 30 latest tags.

like image 40
Alain Tiemblo Avatar answered Oct 21 '22 10:10

Alain Tiemblo