【问题标题】:GitHub REST API: git tag --containsGitHub REST API:git tag --contains
【发布时间】:2016-07-11 03:27:07
【问题描述】:

我正在尝试识别包含特定提交的所有标签。使用 git 命令工具,可以通过以下方式完成:

git tag --contains <commit>

但是,我需要为多个存储库执行此操作,因此我期望依赖 REST API。有没有办法通过 GitHub 的 REST API 收集相同的信息?

【问题讨论】:

    标签: github github-api


    【解决方案1】:

    我在一个相关问题上找到了this answer,以提供我需要的东西。

    您将首先 get a list of tags 为您的回购:

    https://api.github.com/repos/:user/:repo/tags
    

    然后,对于每个标签,您将compare the branch with the SHA

    https://api.github.com/repos/:user/:repo/compare/:tagName...:sha_of_commit
    

    如果响应中status属性的值为divergedahead,则该提交不包含在标签中。如果status 属性的值为behindidentical,则提交包含在标记中。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2023-02-03
      • 2016-10-28
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多