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

查看:22
本文介绍了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):

来自网络界面的结果:

我所期望的是按日期排序的列表.但是,正如您在图片中看到的: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.

发布 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?

提前致谢!

鲁本

推荐答案

Repositories 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.

发布/标签 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天全站免登陆