Github GraphQl-如何获取标签之间的提交列表 [英] Github GraphQl - How to get a list of commits between tags

查看:74
本文介绍了Github GraphQl-如何获取标签之间的提交列表的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

使用Github GraphQL我想回答这个问题:

在版本/标签之间,哪些提交已合并到master中?

结果应类似于此问题的结果获取之间的提交列表如果要在命令行上使用,请在Git中添加标签.

我正在使用开发人员资源管理器,想知道我是否可以通过单个查询执行此操作,或者是否需要多个查询.我尝试了以下操作,但是它没有给我未标记的标签之间的提交,只是没有标记的提交.

  {信息库(所有者:"CoolCompany",名称:"awesome-new-ui"){refs(refPrefix:"refs/tags/",第一个:2,orderBy:{field:TAG_COMMIT_DATE,方向:DESC}){边缘{节点{ID名称目标 {oid...提交时{作者 {日期电子邮件名称}信息}}}}}}} 

来自Github GraphQL社区的

解决方案

@ lee-dohm帮助我找到了已发布的解决方案

第2步:使用createdAt中的值(与发行版或标签相关联),然后执行以下操作:

  {存储库(所有者:"CoolCompany",名称:"awesome-ui"){nameWithOwner对象(表达式:主"){...提交时{oid历史记录(第一个:100,因为:"$ createdAtDate"){节点{oidmessageHeadline作者 {用户{登录}}承诺日期}}}}}} 

With Github GraphQL I want to answer the question:

What commits have been merged into master between releases/tags?

The result should be similar to the results for this question Get commit list between tags in Git if I were to do it on the command line.

I'm using the developer explorer and wondering if I will be able to do this with a single query or if I will need several. I tried the following but it does not give me the commits between tags that have not been tagged, just the tagged commits.

{
  repository(owner: "CoolCompany", name: "awesome-new-ui") {
    refs(refPrefix: "refs/tags/", first: 2, orderBy: {field: TAG_COMMIT_DATE, direction: DESC}) {
      edges {
        node {
          id
          name
          target {
            oid
            ... on Commit {
              author {
                date
                email
                name
              }
              message
            }
          }
        }
      }
    }
  }
}

解决方案

@lee-dohm from the Github GraphQL community helped me arrive at a solution which is posted here

I can paste my solution here as well. It seems this problem is not solve-able with a single query, but it can be done with 2 that work in conjunction with each other:

Step 1: Get the most recent release information. You could modify this for tags as well.

{
  repository(owner: "CoolCompany", name: "awesome-ui") {
    releases(last: 1) {
      edges{
        node{
          tagName
          createdAt
        }
      }
    }
  }
}

Step 2: Use the value from the createdAt (associated with the release or tag) and do this:

{
  repository(owner: "CoolCompany", name: "awesome-ui") {
    nameWithOwner
    object(expression: "master") {
      ... on Commit {
        oid
        history(first: 100, since: "$createdAtDate") {
          nodes {
            oid
            messageHeadline
            author {
              user {
                login
              }
            }
            committedDate
          }
        }
      }
    }
  }
}

这篇关于Github GraphQl-如何获取标签之间的提交列表的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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