I’d like to determine when a card has moved from one column to another in a GitHub Project Board using the GitHub GraphQL API.
I can list all issues in a project board (for example, Twitter Bootstrap) using a query like this one:
{
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
}
}
}
}
}
}
}
}
}
}
}
}
There are many types of events in the IssueTimelineConnection
, but project-related events are not among them:
...
{
"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"
}
]
}
}
...
I can see when issues have been moved between columns on GitHub’s web page for the issue:
I just can’t see these events in the API. Is this a missing feature? Is there another way to get at this information? (Context: I’d like to build a burndown chart for GitHub Project Boards.)
2
Answers
You need to add the Accept header for Project Event Details (https://developer.github.com/v4/previews/#project-event-details) and the Accept header for Issue Preview(https://developer.github.com/v4/previews/#issues-preview)
Then you can use
timelineItems
and run a query like this:This returns:
You can get the column and the last column change date by using the following query for the
new projects
. This method isnot valid
forclassic projects
in GitHub.The query was tested using GitHub Explorer.