Releases API sometimes is not reliable

Releases API sometimes works and sometimes doesn’t. Looks like it really depends on how the releases is generated? I’ve met quite a few repos the API doesn’t work. Is there any reason why and how it can be fixed?

For example the following query return nothing
curl -H “Accept: application/vnd.github.v3+json” https://api.github.com/repos/openjdk/jtreg/releases

While different repos works:
curl -H “Accept: application/vnd.github.v3+json” https://api.github.com/repos/adoptium/run-aqa/releases

1 Like

The GitHub Repository “Releases” page is not just Releases, the interface co-mingles Releases (something you create on GitHub) and Tags (a native git feature). A Tag points to a specific commit and a Release, in turn, points to a Tag, but they’re co-mingled on the interface because for a consumer it is usually the Tag that matters for both a Tag and a Release.

If we visit the Releases of openjdk/jtreg we can see that there are many Tags, but no Releases, whereas in the Releases of adoptium/run-aqa we can see there are many Releases.

The difference between a Release and a Tag on the interface can be identified based on the style of information present, and the information included. A Release has a large heading, and a sub-heading that reads “@username released this n time ago” whereas a Tag simply displays the Tag and the commit it points to.

Release

Tag

If you’d like to programmatically access a list of tags, there is an endpoint, just replace releases with tags.

GET https://api.github.com/repos/openjdk/jtreg/tags

You may also find get a release by tag name helpful.

Thanks @shrink ! That makes sense. Unfortunately using the tag instead of releases can’t assume the tags are in chronological order( in alphabetical order I believe), which makes it difficult to get the latest tag for some repo.

Will use git command git tag --sort=taggerdate with checkout the repository. Close this one.