I'm currently using Octokit.Net in attempt to search and find repositories that meet a specific criteria:
- Repositories that include
Android
somewhere. - Includes any
.xml
files within a path matchingres/layout
- Has a minimum of 100 stars
- etc
The goal is to find Android repositories over 100 stars that include any .xml
files in the res/layout path.
To do this, I've tried to create two separate requests, one in which I use a SearchRepositoriesRequest
to find repositories that match the Android
characteristics and stars.
var request = new SearchRepositoriesRequest("android")
{
Stars = Range.GreaterThan(100),
In = new[] { InQualifier.Readme, InQualifier.Description, InQualifier.Name },
SortField = RepoSearchSort.Stars,
};
I then add these repositories to a RepositoryCollection
and use it within the SearchCodeRequest
which my hope is that within each of these repositories I can then search for the Extension
, Language
, Path
, and more.
var request1 = new SearchCodeRequest()
{
Repos = repositoryCollection,
In = new[] { CodeInQualifier.File, CodeInQualifier.Path },
Language = Language.Xml,
Size = Range.GreaterThan(100),
Path = "res/layout",
Extension = "xml",
};
Generally speaking, is there a way to search a collection of repositories that includes a generic file in a path?
I'm more or less seeing the same results from the Advanced GitHub Search. Sadly this makes me think this isn't possible today with GitHub v3 API.
I did find some limitations within various blogs and similar that seem like this might not be possible?
Considerations for code search
Due to the complexity of searching code, there are a few restrictions on how searches are performed:
Only the default branch is considered. In most cases, this will be the master branch.
Only files smaller than 384 KB are searchable.
You must always include at least one search term when searching source code. For example, searching for language:go is not valid, while amazing language:go is.