/search-github

Primary LanguagePythonMIT LicenseMIT

search-github

This tool is used to query the GitHub GraphQL API to identify the languages, if dependency graph is enabled, and the supported package files in the repositories within a GitHub organization. The GraphQL API is v4 of the GitHub API and GraphQL is a data query language. You can read more about GitHub's GraphQL API and GraphQL here.

Usage

Usage: github_query repos [OPTIONS]

  Query for all repositories, along with languages and dependencies of each one for a GitHub organization.

Options:
  -o, --org TEXT  Name of the GitHub organization  [required]
  --token TEXT    GitHub token  [required]
  --output        Set this flag to output to 'results.csv'
  --help          Show this message and exit.

A GitHub token is required to use this tool. Read "Creating a personal access token" to learn how to create a token.

Installation

This tool makes use of Click for creating the command line interface. To install the tool and the required packages run the following command*:

pip install --editable .

* You may choose to run this command inside of a virtual environment.

Queries

The query used in this tool was created using GitHub's GraphQL Explorer.

The API has a limit of 100 items/request. To help with navigating that limit the code uses a Python Generator to behave like an iterator to loop through all of the pages of items.