github - 如何使用 GitHub GraphQL API 在项目中的列之间移动问题?
问题描述
我想使用 GitHub GraphQL API确定卡片何时在GitHub 项目板中从一列移动到另一列。
我可以使用如下查询列出项目板(例如Twitter Bootstrap)中的所有问题:
{
organization(login: "twbs") {
repository(name: "bootstrap") {
project(number: 4) {
columns(first: 5) {
nodes {
name
cards(first: 10) {
nodes {
content {
__typename
... on Issue {
title
url
timeline(first: 10) {
nodes {
__typename
}
}
}
}
}
}
}
}
}
}
}
}
中的事件类型很多IssueTimelineConnection
,但与项目相关的事件不在其中:
...
{
"content": {
"__typename": "Issue",
"title": "Remove inner white border effect on popovers",
"url": "https://github.com/twbs/bootstrap/issues/23763",
"timeline": {
"nodes": [
{
"__typename": "RenamedTitleEvent"
},
{
"__typename": "IssueComment"
},
{
"__typename": "LabeledEvent"
},
{
"__typename": "LabeledEvent"
},
{
"__typename": "IssueComment"
},
{
"__typename": "CrossReferencedEvent"
},
{
"__typename": "CrossReferencedEvent"
},
{
"__typename": "LabeledEvent"
},
{
"__typename": "ClosedEvent"
},
{
"__typename": "CrossReferencedEvent"
}
]
}
}
...
我可以看到问题何时在 GitHub 网页上针对该问题的列之间移动:
我只是在 API 中看不到这些事件。这是缺少的功能吗?还有其他方法可以获取此信息吗?(背景:我想为 GitHub Project Boards 建立一个燃尽图。)
解决方案
您需要为项目事件详细信息 ( https://developer.github.com/v4/previews/#project-event-details )添加 Accept 标头,并为问题预览 ( https://developer.github.com添加 Accept 标头/v4/previews/#issues-preview )
然后您可以使用timelineItems
并运行这样的查询:
query {
repository(owner: "buildo", name: "react-components") {
issue(number: 1321) {
timelineItems(first: 10) {
nodes {
__typename
}
}
}
}
}
这将返回:
{
"repository": {
"issue": {
"timelineItems": {
"nodes": [
{
"__typename": "ConvertedNoteToIssueEvent"
},
{
"__typename": "AssignedEvent"
},
{
"__typename": "LabeledEvent"
},
{
"__typename": "MovedColumnsInProjectEvent"
}
]
}
}
}
}
推荐阅读
- tensorflow - 在 tensorflow 2.0 中添加无维度
- java - 关于同步关键字?
- excel - POWERSHELL 计划任务:windows server 2019 和 excel 2013
- asp.net-core - 使用 IOC 容器进行依赖注入:根据请求者提供服务
- android - java.lang.IllegalArgumentException:找不到改造注释。(参数#4)
- django - 列表对象在 drf 中没有属性模型
- android-studio - 在颤振行中不显示任何内容
- android - androdroiP 上的 vts 错误:TestInvocation: Unexpected exception when running invocation: java.lang.RuntimeException: Failed to get device information
- gherkin - Cucumber Java 中的参数化场景名称
- oop - 每个操作上下文的不同不变量