turbot/github

steampipe plugin install githubsteampipe plugin install github

GitHub + Steampipe

GitHub is a provider of Internet hosting for software development and version control using Git. It offers the distributed version control and source code management (SCM) functionality of Git, plus its own features.

Steampipe is an open source CLI to instantly query cloud APIs using SQL.

For example:

select
name,
language,
forks_count,
stargazers_count
from
github_my_repository;
+-------------------------------+------------+-------------+------------------+
| name | language | forks_count | stargazers_count |
+-------------------------------+------------+-------------+------------------+
| steampipe | Go | 11 | 254 |
| steampipe-plugin-aws | Go | 8 | 18 |
| steampipe-plugin-shodan | Go | 0 | 9 |
| steampipe-plugin-gcp | Go | 0 | 8 |
| steampipe-postgres-fdw | C | 0 | 8 |
| steampipe-plugin-azure | Go | 1 | 8 |
| steampipe-plugin-sdk | Go | 0 | 6 |
+-------------------------------+------------+-------------+------------------+

Documentation

Get started

Install

Download and install the latest GitHub plugin:

steampipe plugin install github

Credentials

ItemDescription
CredentialsThe GitHub plugin uses a personal access token to authenticate to the GitHub APIs.
PermissionsYou must create a Personal Access Token and assign the following scopes:
    - repo (all)
    - read:org
    - read:user
    - gist
    - user:email
RadiusThe GitHub plugin query scope is generally the same as the GitHub API. Usually, this means you can list private resources that you have access to, as well as public resources that you own, or that are owned by organizations to which you belong. The same GitHub APIs are used to get information for public resources, but the public items are returned in list calls (because there would be too many). This has an interesting side effect in Steampipe in that you can sometimes query a specific item by a specific key column or columns that does not show up in a list query.

For example, select * from github_organization will list details about all the GitHub Organizations to which you belong. select * from github_organization where login = 'postgres' will show you the publicly available details about the postgres organization, which didn't show up in your first query! It works this way in Steampipe because that's how it works in the API. While this may seem counter-intuitive at first, it actually can be quite useful.
Resolution1. Credentials specified in environment variables e.g. GITHUB_TOKEN.
2. Credentials in the Steampipe configuration file (~/.steampipe/config/github.spc)

Configuration

Installing the latest aws plugin will create a config file (~/.steampipe/config/github.spc) with a single connection named github:

connection "github" {
plugin = "github"
token = "111222333444555666777888999aaabbbcccddde"
}

Get involved