Unable to query info for issues in Projects
Hi. I'm running into a problem where I am unable query titles, ids, etc. for items in projects that are issues. I have not tested with pull requests, but I am able to query info for draft issues.
For example, the following GraphQL query works fine in the GitHub GraphQL API Explorer and with gh api (filling in a valid ProjectV2Item's node_id).
query GitHubProjectItemQuery($node_id: ID = "") {
node(id: $node_id) {
... on ProjectV2Item {
content {
... on DraftIssue {
title
}
... on Issue {
title
}
... on PullRequest {
title
}
}
}
}
}
This is the equivalent I am using in Go.
var GitHubProjectItemQuery struct {
Node struct {
ProjectV2Item struct {
Content struct {
DraftIssue struct {
Title string
} `graphql:"... on DraftIssue"`
Issue struct {
Title string
} `graphql:"... on Issue"`
PullRequest struct {
Title string
} `graphql:"... on PullRequest"`
}
} `graphql:"... on ProjectV2Item"`
} `graphql:"node(id: $node_id)"`
}
variables := map[string]interface{}{
"node_id": githubv4.ID(node_id),
}
err := githubClient.Query(context.Background(), &GitHubProjectItemQuery, variables)
Oddly, for draft issues, the title appears in GitHubProjectItemQuery.Node.ProjectV2Item.Content.DraftIssue.Title, GitHubProjectItemQuery.Node.ProjectV2Item.Content.Issue.Title, and GitHubProjectItemQuery.Node.ProjectV2Item.Content.PullRequest.Title. For issues, nothing appears for any title, id, etc.
Any ideas as to what exactly is going on here? Thanks for the help.