From de61b2b65dde6166720bbf68fc2abb9dc5efedee Mon Sep 17 00:00:00 2001 From: yuvrajangadsingh Date: Tue, 10 Feb 2026 16:57:25 +0530 Subject: [PATCH] feat(pr): add changeType field to files JSON output Add the changeType field from the PullRequestChangedFile GraphQL type to the PullRequestFile struct. This exposes the file status (added, modified, deleted, renamed, copied, changed) in gh pr list --json files and gh pr view --json files output. Closes #11385 --- api/queries_pr.go | 7 ++++--- api/query_builder.go | 3 ++- api/query_builder_test.go | 4 ++-- 3 files changed, 8 insertions(+), 6 deletions(-) diff --git a/api/queries_pr.go b/api/queries_pr.go index 1bc5ddb55..c38018a68 100644 --- a/api/queries_pr.go +++ b/api/queries_pr.go @@ -296,9 +296,10 @@ type PullRequestCommitCommit struct { } type PullRequestFile struct { - Path string `json:"path"` - Additions int `json:"additions"` - Deletions int `json:"deletions"` + Path string `json:"path"` + Additions int `json:"additions"` + Deletions int `json:"deletions"` + ChangeType string `json:"changeType"` } type ReviewRequests struct { diff --git a/api/query_builder.go b/api/query_builder.go index cb80b595f..c3e1e9ba3 100644 --- a/api/query_builder.go +++ b/api/query_builder.go @@ -148,7 +148,8 @@ var prFiles = shortenQuery(` nodes { additions, deletions, - path + path, + changeType } } `) diff --git a/api/query_builder_test.go b/api/query_builder_test.go index f854cd36a..f0b5789a3 100644 --- a/api/query_builder_test.go +++ b/api/query_builder_test.go @@ -26,7 +26,7 @@ func TestPullRequestGraphQL(t *testing.T) { { name: "compressed query", fields: []string{"files"}, - want: "files(first: 100) {nodes {additions,deletions,path}}", + want: "files(first: 100) {nodes {additions,deletions,path,changeType}}", }, { name: "invalid fields", @@ -72,7 +72,7 @@ func TestIssueGraphQL(t *testing.T) { { name: "compressed query", fields: []string{"files"}, - want: "files(first: 100) {nodes {additions,deletions,path}}", + want: "files(first: 100) {nodes {additions,deletions,path,changeType}}", }, { name: "projectItems",