Help
cancel
Showing results for 
Search instead for 
Did you mean: 
Highlighted
Copilot Lvl 2
Message 1 of 3

How to get contents of the files with a specific name in a given repository?

Solved! Go to Solution.

I'm trying to fetch the contents of all the files with the name `_config.jsonnet` in this repository (https://github.com/rakam-io/segment-recipe).

 

I tried the following query:

query GetFilesQuery($branch: GitObjectID, $query: String!) {
  search(first: 1, type: REPOSITORY, query: $query) {
    edges {
      node {
        ... on Repository {
          object(expression: "master:", oid: $branch) {
            ... on Tree {
              entries {
                name
                object {
                  ... on Blob {
                    text
                  }
                }
              }
            }
          }
        }
      }
    }
  }
}

 

with the parameters with no luck:

 

{"branch": null, "query": "repo:rakam-io/segment-recipe extension:jsonnet filename:_config"}

 

Is there anything that I'm missing or the API doesn't support it>

2 Replies
Solution
Community Manager
Message 2 of 3

Re: How to get contents of the files with a specific name in a given repository?

The GraphQL search connection currently doesn't support code results, only repository, issue, and user results. For now, you'll have to use the v3 API to search for code.

 

I hope that helps!

Ground Controller Lvl 1
Message 3 of 3

Re: How to get contents of the files with a specific name in a given repository?

OK j'essaie pour voir le résultat...