Include id in linked-issue JSON exports

Add id to the GraphQL fragment for subIssues, blockedBy, and blocking
nodes so the canonical node identifier is fetched, and surface it in
the JSON output alongside number/title/url/state for parent, subIssues,
blockedBy, and blocking.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This commit is contained in:
Kynan Ware 2026-05-06 15:54:39 -06:00
parent 469438ebc5
commit 20105edbcb
2 changed files with 7 additions and 3 deletions

View file

@ -51,6 +51,7 @@ func (issue *Issue) ExportData(fields []string) map[string]interface{} {
case "parent":
if issue.Parent != nil {
data[f] = map[string]interface{}{
"id": issue.Parent.ID,
"number": issue.Parent.Number,
"title": issue.Parent.Title,
"url": issue.Parent.URL,
@ -63,6 +64,7 @@ func (issue *Issue) ExportData(fields []string) map[string]interface{} {
items := make([]map[string]interface{}, 0, len(issue.SubIssues.Nodes))
for _, n := range issue.SubIssues.Nodes {
items = append(items, map[string]interface{}{
"id": n.ID,
"number": n.Number,
"title": n.Title,
"url": n.URL,
@ -80,6 +82,7 @@ func (issue *Issue) ExportData(fields []string) map[string]interface{} {
items := make([]map[string]interface{}, 0, len(issue.BlockedBy.Nodes))
for _, n := range issue.BlockedBy.Nodes {
items = append(items, map[string]interface{}{
"id": n.ID,
"number": n.Number,
"title": n.Title,
"url": n.URL,
@ -91,6 +94,7 @@ func (issue *Issue) ExportData(fields []string) map[string]interface{} {
items := make([]map[string]interface{}, 0, len(issue.Blocking.Nodes))
for _, n := range issue.Blocking.Nodes {
items = append(items, map[string]interface{}{
"id": n.ID,
"number": n.Number,
"title": n.Title,
"url": n.URL,

View file

@ -447,13 +447,13 @@ func IssueGraphQL(fields []string) string {
case "parent":
q = append(q, `parent{id,number,title,url,state,repository{nameWithOwner}}`)
case "subIssues":
q = append(q, `subIssues(first:50){nodes{number,title,url,state,repository{nameWithOwner}},totalCount}`)
q = append(q, `subIssues(first:50){nodes{id,number,title,url,state,repository{nameWithOwner}},totalCount}`)
case "subIssuesSummary":
q = append(q, `subIssuesSummary{total,completed,percentCompleted}`)
case "blockedBy":
q = append(q, `blockedBy(first:50){nodes{number,title,url,state,repository{nameWithOwner}}}`)
q = append(q, `blockedBy(first:50){nodes{id,number,title,url,state,repository{nameWithOwner}}}`)
case "blocking":
q = append(q, `blocking(first:50){nodes{number,title,url,state,repository{nameWithOwner}}}`)
q = append(q, `blocking(first:50){nodes{id,number,title,url,state,repository{nameWithOwner}}}`)
default:
q = append(q, field)
}