Github GraphQl - 如何获取标签之间的提交列表 [英] Github GraphQl - How to get a list of commits between tags
问题描述
我想用 Github GraphQL 回答这个问题:
<块引用>哪些提交已合并到版本/标签之间的 master 中?
结果应该类似于这个问题的结果获取提交列表之间Git 中的标签,如果我要在命令行上做的话.
我正在使用开发者资源管理器,想知道我是否可以通过一个查询来完成这项工作,或者我是否需要多个查询.我尝试了以下操作,但它没有给我未标记的标记之间的提交,只是标记的提交.
<代码>{存储库(所有者:CoolCompany",名称:awesome-new-ui"){refs(refPrefix: "refs/tags/", first: 2, orderBy: {field: TAG_COMMIT_DATE, direction: DESC}) {边{节点{ID名称目标 {类...在提交{作者 {日期电子邮件名称}信息}}}}}}}
来自 Github GraphQL 社区的@lee-dohm 帮助我找到了一个解决方案,该解决方案已发布在 这里>
我也可以在这里粘贴我的解决方案.似乎这个问题无法通过单个查询解决,但可以通过两个相互结合的查询来解决:
第 1 步:获取最新版本信息.您也可以针对标签进行修改.
<代码>{存储库(所有者:CoolCompany",名称:awesome-ui"){发布(最后:1){边{节点{标签名称创建于}}}}}
第 2 步:使用 createdAt 中的值(与发布或标记相关联)并执行以下操作:
<代码>{存储库(所有者:CoolCompany",名称:awesome-ui"){名称与所有者对象(表达式:主人"){...在提交{类历史(第一个:100,因为:$createdAtDate"){节点{类留言标题作者 {用户{登录}}提交日期}}}}}}
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屋!