Github GraphQL to recursively list all files in the directory

There is no way to recursively iterate in GraphQL. However, you can do so programmatically using a query variable:

query TestQuery($branch: GitObjectID) {
 search(first: 1, type: REPOSITORY, query: "language:C") {
    edges {
      node {
        ... on Repository {
          object(expression: "master:", oid: $branch) {
            ... on Tree {
              entries {
                oid
                name
                type
              }
            }
          }
        }
      }
    }
  }
}

Start with a value of null and go from there.


working example

More info: https://docs.sourcegraph.com/api/graphql/examples

But probably this will change in the near feature. For example latest github version is v4 https://developer.github.com/v4/explorer/