Schema request to fetch a list of changed files associated with a pull request



There is an existing v3 REST API call for this, however there does not appear to be a way to gain this information via GraphQL. I can get a list of the root Tree of a given commit, but that’s all the files in the root, not the changed files.


+1. Related to this post.


We needed that to implement a bot, unfortunately we had to go back to v3, since it is not implemented yet.


I’ve added this request to our internal tracker. We’ll give an update here as soon as we have something to share.


Just stumbled on this missing feature. I’ll be looking forward for it.


+1 also had to drop back to v3 because of this =(


I’m mixing v3 with v4 to get what I need :confused:


Any updates on this? It has been open for a while.


I ran into this missing in v4 compared to v3 as well. :+1:

As an observation, of the following PR fields available in v3:

"comments": 10,
"commits": 3,
"additions": 100,
"deletions": 3,
"changed_files": 5,

It’s possible to get the first two:

comments {
commits {

But not the last three.


An update. As of October 27, 2017 (2 days after my reply above), it’s now possible to get additions and deletions as well. Those fields have been added to the PullRequest object. See

That means changed_files is the last remaining property that still can’t be fetched via GitHub GraphQL API v4.


Any update on how we can get the list of files?
I guess mixing with V3 isn’t the intended solution , right?


I’ve run into this myself a few times now. I’m preparing a presentation on “GraphQL for integrators” using GitHub’s GraphQL as an example, and I would love to show one bit that requires this to work. Can you by any chance give a rough ETA?


Hey @gr2m, @cohenjo,

This is in our list of things to do. We’ll get it done as soon as we can :slight_smile:

I’ll be sure to update this thread when we release this.


It looks like this has been implemented already - see here


@ericat changedFiles is just an integer, telling how many files have changed, not a connection to file nodes


yes, that is true :’(


What’s the ETA for supporting the equivalent of the v3 list pull request files API ( in GraphQL v4? Also, would it be possible to get the number of additions and deletions per file as well?


The raw data present at patch_url can be easily regexed to find names of files changed along with their paths. :sweat_smile:


Let me start by saying that we do not have an ETA of when this will be complete, but listing pull request files is something that I am personally working on right now.

Internally at GitHub we’re working on a project to get us closer to the same amount of coverage in our GraphQL schema that we have in the REST API. The way we’re doing that is REST resource by REST resource, and it unfortunately takes time to ensure that we have the right schema design and are confident that we won’t break it in the future. The particular resource that I’m working on right now is the one that’s returned in GET /repos/:owner/:repo/pulls/:number/files.

In order to do this, we take a multi-step process:

  1. Add the appropriate objects, fields, connections, etc to the GraphQL schema in order to build the exact same REST resource that we return in the V3 API.
  2. Craft a query using this new schema to return all of the data that we need for the REST resource in question
  3. Take the result of the query and massage it into a format that looks identical to the REST response of a given endpoint
  4. Use the Scientist library to ensure that the results look correct (return the right types, etc)

I’ll update this thread as soon as we get closer to shipping this and adding the appropriate items to the public schema.

Thank you for your patience :bowing_man:.