Github's tag method returns a list of all tags pushed to your repo with the latest tag listed at the top. Here's an example call: https://api.github.com/repos/ff0000/rosy/tags which produces the following json object.
[{
name: "rbp-folder-rename",
zipball_url: "https://api.github.com/repos/ff0000/rosy/zipball/rbp-folder-rename",
tarball_url: "https://api.github.com/repos/ff0000/rosy/tarball/rbp-folder-rename",
commit: {
sha: "09ebda2678d932a005fc86ab78f6c04eebdcd50d",
url: "https://api.github.com/repos/ff0000/rosy/commits/09ebda2678d932a005fc86ab78f6c04eebdcd50d"
}
},
{
name: "2.0.10",
zipball_url: "https://api.github.com/repos/ff0000/rosy/zipball/2.0.10",
tarball_url: "https://api.github.com/repos/ff0000/rosy/tarball/2.0.10",
commit: {
sha: "fe284c7d461107d9d08d2d4dcb676759f9485fc1",
url: "https://api.github.com/repos/ff0000/rosy/commits/fe284c7d461107d9d08d2d4dcb676759f9485fc1"
}
},
// ....
{
name: "2.1.5",
zipball_url: "https://api.github.com/repos/ff0000/rosy/zipball/2.1.5",
tarball_url: "https://api.github.com/repos/ff0000/rosy/tarball/2.1.5",
commit: {
sha: "db92baa49657b3c3d27b1475c415c19525cb2118",
url: "https://api.github.com/repos/ff0000/rosy/commits/db92baa49657b3c3d27b1475c415c19525cb2118"
}
}]
master
branch only? I'd like to programmatically retrieve the latest stable version of a repo.Any help / insight would be appreciated.
You could simply replace the tag by the branch name:
https://api.github.com/repos/ff0000/rosy/zipball/master
See the more general form of that query (for a given branch) in "Is there anyway to programmatically fetch a zipball of private github repo?".
But that presume that the latest stable version of a repo is in master
(it could be the latest 'development', which might not be very stable past the fact that it compile and passes basic unit test): each project can have its own convention.
For what it's worth, https://api.github.com/repos/ff0000/rosy/branches
would list the branches for that same repo.