Graphql get branch contents dynamically

I need to get the contens of the file via graphql in a dynamic way. I can get the list of branches via the following query. How can i get the contents of the file in each repo in a dynamic manner.

refs(first: 5, refPrefix: "refs/heads/") {
          nodes {

Suppose i have a file that i need to audit in each branch how can i get the contents of the file inside that loop. the below ex is used to get the file content of the master branch. How to apply this in the above scenario in a dynamic way

object(expression: "") {
	...on Blob {


Parithiban G

I think you’d need 2 queries:

  1. a query to get the HEAD of each branch (using

  2. a second query to get the relevant file for each branch: send a query with a bunch of concatenated and aliased object(oid: …) with the OIDs you got on step 1.

Because sadly Github’s Commit / Tree objects provide no way to access a specific blob, as far as I can tell you can get all the entries of a tree, but you can’t get a specific entry.