Skip to content

feat(pr): add changeType field to files JSON output#12657

Merged
BagToad merged 1 commit intocli:trunkfrom
yuvrajangadsingh:feature/pr-files-status
Mar 3, 2026
Merged

feat(pr): add changeType field to files JSON output#12657
BagToad merged 1 commit intocli:trunkfrom
yuvrajangadsingh:feature/pr-files-status

Conversation

@yuvrajangadsingh
Copy link
Contributor

Adds the changeType field to the files JSON output for gh pr list and gh pr view.

This exposes the file's patch status (ADDED, MODIFIED, DELETED, RENAMED, COPIED, CHANGED) which was already available in the GraphQL API but not surfaced in the CLI output.

Before:

{
  "files": [
    { "path": "docs/readme.md", "additions": 1, "deletions": 1 }
  ]
}

After:

{
  "files": [
    { "path": "docs/readme.md", "additions": 1, "deletions": 1, "changeType": "MODIFIED" }
  ]
}

Changes:

  • Added ChangeType field to PullRequestFile struct (api/queries_pr.go)
  • Added changeType to the GraphQL files query (api/query_builder.go)
  • Updated query builder test expectations

Closes #11385

@yuvrajangadsingh yuvrajangadsingh marked this pull request as ready for review February 10, 2026 11:46
@yuvrajangadsingh yuvrajangadsingh requested a review from a team as a code owner February 10, 2026 11:46
@cliAutomation cliAutomation added the external pull request originating outside of the CLI core team label Feb 10, 2026
@yuvrajangadsingh
Copy link
Contributor Author

Hey @BagToad — this PR implements the changeType field for gh pr view --json files that you discussed in #11385. It adds Added, Deleted, Modified, Renamed, and Copied change types to the files JSON output.

Ready for review whenever you get a chance!

@yuvrajangadsingh yuvrajangadsingh force-pushed the feature/pr-files-status branch 3 times, most recently from 58cdd56 to 70ebb4d Compare February 23, 2026 19:31
@yuvrajangadsingh
Copy link
Contributor Author

bumping this as well — pretty small change, adds changeType to the files JSON output. let me know if there's anything blocking review.

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 cli#11385
@yuvrajangadsingh yuvrajangadsingh force-pushed the feature/pr-files-status branch from 70ebb4d to de61b2b Compare March 1, 2026 10:05
Copy link
Member

@BagToad BagToad left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, LGTM.

@BagToad BagToad merged commit 39874b7 into cli:trunk Mar 3, 2026
11 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

external pull request originating outside of the CLI core team

Projects

None yet

Development

Successfully merging this pull request may close these issues.

add status to the gh pr list "files" payload

3 participants