Mathu
Mathu

Reputation: 63

GitHub API to get the release date of particular release of repo

I want to get a release date of a particular repository. For example, i want to get the release date of Jquery release 3.0.0. How can I use git API to get a release date?

Upvotes: 1

Views: 252

Answers (1)

karthick
karthick

Reputation: 12176

You can use /git/ref/tags to get all the tags and from that find the commit data, which will have the date.

fetch('https://api.github.com/repos/jquery/jquery/git/refs/tags/3.0.0')
.then(function(response){ 
    return response.json();
 }).then(function(tagData){ 
    return fetch(tagData.object.url);
 }).then(function(commitResponse){
        return commitResponse.json();
 }).then(function(commitData){
    console.log(commitData['committer'].date)
 })

Upvotes: 2

Related Questions