GitHub API获取repo的特定发布日期



我想获得特定存储库的发布日期。例如,我想获取jQuery Release 3.0.0的发布日期。如何使用git api获取发布日期?

您可以使用/git/ref/tag获取所有标签,从该查找提交数据,该数据将具有日期。

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)
 })

最新更新