With Github's search API, i can search for repository's name or user's name.
How can i search the file name in the specific Github repository?
I mean how can i do that: in repo jquery/jquery, i search for "selector" keyword, i will have selector.js, selector-sizzle.js, selector-native.js and selector-folder
Thank you
Open a repository on GitHub and press t to open the File Finder. This let's you find files by name (or name of the directory) in the current repo.
GitHub Codesearch can be found at github.com/codesearch and will let you type in anything you're looking for in source code and get highlighted results of any files in our public repositories that match.
The file finder feature allows you to search for a file in a repository using the GitLab UI. To use it: Go to your project's Repository > Files. In the upper right corner, select Find File.
One workaround would be to do a code search, with:
q
: a word than you know is in the file you are looking forfilename
: the name of the file you are looking for (see "Search by filename")For instance, if you are looking for classes.js
in the repo jquery/jquery
, which you know has to contain the word 'addClass
':
https://api.github.com/search/code?q=addClass+repo:jquery/jquery+filename:classes.js
Take the result with a score > 1
"name": "classes.js",
"path": "src/attributes/classes.js",
braitsch adds in the comments:
Instead of "
score
", inspect the "total_count
" property of the object returned by the query as "score
" will be absent if the requested file is not found.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With