GitHub Searcher
ghsearcher is a utility for searching GitHub from the command line.
Usage
- Install with pip
pip install ghsearcher
- (Optional) you can either export an environment variable named "GH_TOKEN" or include it in a local .env file to ensure you can make the most requests. See "Creating a personal access token" for more information on how to do so.
usage: ghsearcher [-h] [-v] [--debug]
[-e {users,code,issues,commits,labels,repos,topics}] [-o OUTPUT_FILE]
-q QUERY [QUERY ...]
Search for things in GitHub
optional arguments:
-h, --help show this help message and exit
-v, --version show program's version number and exit
--debug Set this if you would like to see verbose logging.
-e {users,code,issues,commits,labels,repos,topics}, --endpoint {users,code,issues,commits,labels,repos,topics}
Endpoint you would like to search
-o OUTPUT_FILE, --output-file OUTPUT_FILE
File name for where you want the JSON output to go. eg:
output/test will output a file in the output dir with the file
name test-2022-01-01.json
-q QUERY [QUERY ...], --query QUERY [QUERY ...]
Query you would like to use to search
To learn about building queries you can check the following documentaiton for GitHubs search queries:
https://docs.github.com/en/rest/reference/search#constructing-a-search-query
Here is a simple example. The Kafka project is trying to better track if users are having issues with implementing their kafka into thier project so the create a data pipeline with the following to find issues in other repos featuring Kafka.
This example finds all issues including "Kafka" created on or after 2022-01-18 and outputting it to kafka_output_file-(todays date).json
# The source is a repo and it is running against the gh_dorks_test.txt file
ghsearcher -e issues -q "Kafka created:>2022-01-18" -o kafka_output_file