GitHub API(v3):按创建日期排序标签 [英] GitHub API (v3): Order tags by creation date

查看:263
本文介绍了GitHub API(v3):按创建日期排序标签的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在使用GitHub API时遇到一个问题.

I ran into a problem / question while using the GitHub API.

我需要在单个标签之后创建的所有标签的列表.唯一的方法是按日期比较标签.但是,API的结果未按日期排序:

I need a list of all tags created after a single tag. The only way to do this, is to compare the tags by date. However, the results from the API aren't ordered by date:

API的结果(rails存储库示例):

Result from the API (rails repository example):

Web界面的结果:

我期望的是按日期排序的列表.但是,如您在图片中所见:API返回v4.0.0rc1& v4.0.0rc2在发布v4.0.0之前,而4.0.0在发布候选版本之后发布.甚至没有在服务器端订购的创建/提交日期.

What i did expect is a list ordered by date. However, as you can see in the pictures: the API is returning v4.0.0rc1 & v4.0.0rc2 before the release of v4.0.0, while 4.0.0 is released after the release candidates. There isn't even a creation / commit date to order at server side.

releases API也不是解决方案.该API仅返回由Github创建的版本,而不返回由标签创建的版本.

The releases API isn't a solution either. This API is only returning releases created by Github, not the releases created by tags.

有什么办法可以按日期排序标签?

Is there any way to order the tags by date?

提前谢谢!

鲁本

推荐答案

存储库API 当前以"git tag"命令返回标签的顺序返回标签,这意味着它们是按字母顺序排序的.

The Repositories API currently returns tags in the order they would be returned by the "git tag" command, which means they are alphabetically sorted.

在Git中按时间顺序对标签进行排序的问题在于,标签有两种类型,即轻型和带注释的),而对于轻型类型,Git不存储创建日期.

The problem with sorting tags chronologically in Git is that there are two types of tags, lightweight and annotated), and for the lightweight type Git doesn't store the creation date.

Release/Tags UI当前按标签指向的提交日期按时间顺序对标签进行排序.再次不是标签本身的创建日期,但它确实确定了事物的时间顺序.

The Releases/Tags UI currently sorts tags chronologically by the date of the commit to which the tag points to. This again isn't the date on which the tag itself was created, but it does establish a chronological order of things.

在我们的功能请求列表上,将此替代排序选项添加到API.

Adding this alternative sorting option to the API is on our feature request list.

这篇关于GitHub API(v3):按创建日期排序标签的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆