This tool is used to reliably enumerate projects on GitHub.
The output of this tool is can be used as an input for the criticality_score
tool, or for input for the collect_signals worker.
$ export GITHUB_TOKEN=ghp_x # Personal Access Token Goes Here
$ enumerate_github \
-start 2008-01-01 \
-min-stars=10 \
-workers=1 \
-out=github_projects.txt$ go install github.com/ossf/criticality_score/v2/cmd/enumerate_github@latest$ enumerate_github [FLAGS]...The URL for each repository is written to the output. By default stdout is used
for output.
FLAGS are optional. See below for documentation.
A comma delimited environment variable with one or more GitHub Personal Access Tokens must be set
Supported environment variables are GITHUB_AUTH_TOKEN, GITHUB_TOKEN,
GH_TOKEN, or GH_AUTH_TOKEN.
Example:
$ export GITHUB_TOKEN=ghp_abc,ghp_123-out FILEspecify theFILEto use for output. By defaultstdoutis used.-appendappends output toFILEif it already exists.-forceoverwritesFILEif it already exists and-appendis not set.-format {text|scorecard}indicates the format to use for output.textis used by default and consists of one URL per line.scorecardoutputs a CSV file compatible with the scorecard project.
If FILE exists and neither -append nor -force is set the command will fail.
-start datethe start date to enumerate back to. Must be at or after2008-01-01. Defaults to2008-01-01.-end datethe end date to enumerate from. Defaults to today's date.
-min-stars intonly enumerates repositories with this or more of stars Defaults to10.-query stringsets the base query to use for enumeration. Defaults tois:public. See GitHub's search help for more detail.-require-min-starsabort execution if-min-starscan't be reached during enumeration. If not set some repositories created on a certain date may not be included.-star-overlap intthe number of stars to overlap between queries. Defaults to5. A an overlap is used to avoid missing repositories whose star count changes during enumeration.
-log levelset the level of logging. Can bedebug,info(default),warnorerror.-workers intthe total number of concurrent workers to use. Default is1.-helpdisplays help text.
Refer to Milestone 1 for details on the algorithm.
10 has been successfully tested, although lower may be possible.
TODO -- more detail
A single GitHub Personal Access Token took about 4 hours to return all projects with >= 20 stars.
Faster performance can be achieved with more Personal Access Tokens and additional workers.
Generally, use 1 worker for each Personal Access Token.
More workers than tokens may result in secondary rate limits.
It is possible that more restricted searches will succeed with more workers per token.
Rather than installing the binary, use go run to run the command.
For example:
$ go run ./cmd/enumerate_github [FLAGS]...Limiting the data allows for runs to be completed quickly. For example:
$ go run ./cmd/enumerate_github \
-log=debug \
-start=2022-06-14 \
-end=2022-06-21 \
-min-stars=20