我正在尝试编写一个脚本,该脚本将获取github中特定存储库的最新版本,然后显示自该版本创建以来的提交。
我知道我可以使用这个提交:
https://developer.github.com/v3/repos/commits/#list-commits-on-a-repository
我希望获得最新版本的published_at
日期,以便我可以使用它来创建对github API的请求,如下所示:
curl https://api.github.com/repos/RepoOwner/MyRepo/commits?since=2015-01-01T00:00:00Z
2015-01-01T00:00:00Z
恰好是最新版本的published_at
日期。我知道我可以获得这样的版本列表:
https://developer.github.com/v3/repos/releases/#list-releases-for-a-repository
我的计划是按日期降序获取版本列表,然后检查第一个版本以确定发布日期是什么。但排序似乎不起作用。指定结果应按sort=published_at
排序asc
或desc
order
似乎具有相同的结果(https://api.github.com/repos/ReporOwner/myrepo/releases?sort=published_at&order=desc
与{{1} })。我猜测github API不支持对此结果集列表进行排序。
还有其他方法可以获得最近发布的日期吗?