turbot/github

steampipe plugin install githubsteampipe plugin install github

Table: github_my_repository

A repository contains all of your project's files and each file's revision history.

You can own repositories individually, or you can share ownership of repositories with other people in an organization. The github_my_repository table will list tables you own, you collaborate on, or that belong to your organizations.

To query ANY repository, including public repos, use the github_repository table.

Examples

List of repositories that you or your organizations own or contribute to

select
name,
owner_login,
full_name
from
github_my_repository
order by
full_name;

Show repository stats

select
name,
owner_login,
language,
forks_count,
stargazers_count,
subscribers_count,
watchers_count,
description
from
github_my_repository;

List your public repositories

select
name,
private,
visibility,
owner_login
from
github_my_repository
where
not private;

OR

select
name,
private,
visibility
from
github_my_repository
where
visibility = 'public';

List all your repositories and their collaborators

select
name,
collaborator_logins
from
github_my_repository;

List collaborators and their permissions in your repositories

select
name,
c ->> 'login' as login,
c -> 'permissions' -> 'pull' as can_pull,
c -> 'permissions' -> 'push' as can_push,
c -> 'permissions' -> 'admin' as is_admin
from
github_my_repository,
jsonb_array_elements(collaborators) as c
order by
name,
c ->> 'login';

List collaborators who have "push" or "admin" to a specific repository

In this case, collaborators who have "push" or "admin" to the turbot/steampipe-plugin-aws repository:

select
name,
c ->> 'login' as login,
c -> 'permissions' -> 'pull' as can_pull,
c -> 'permissions' -> 'push' as can_push,
c -> 'permissions' -> 'admin' as is_admin
from
github_my_repository,
jsonb_array_elements(collaborators) as c
where
name = 'steampipe-plugin-aws'
and owner_login = 'turbot'
and (
(c -> 'permissions' -> 'admin') :: bool
or (c -> 'permissions' -> 'push') :: bool
);

List collaborators for organization repositories that are not organization members

In this case, for the turbot org:

select
name,
owner_login as owner,
c ->> 'login' as login,
c -> 'permissions' -> 'pull' as can_pull,
c -> 'permissions' -> 'push' as can_push,
c -> 'permissions' -> 'admin' as is_admin
from
github_my_repository as r,
jsonb_array_elements(collaborators) as c
where
owner_login = 'turbotio'
and c ->> 'login' not in (
select
m ->> 'login' as member_login
from
github_organization,
jsonb_array_elements(members) as m
where
login = 'turbotio'
);

.inspect github_my_repository

GitHub Repositories that you are associated with. GitHub Repositories contain all of your project's files and each file's revision history.

NameTypeDescription
allow_merge_commitbooleanIf true, the repository allows merge commits.
allow_rebase_mergebooleanIf true, the repository allows rebase merges.
allow_squash_mergebooleanIf true, the repository allows squash merges.
archivedbooleanIf true, the repository is archived and read-only.
clone_urltextURL that can be provided to git clone to clone the repository via HTTPS.
code_of_conduct_keytextUnique key for code of conduct for the repository.
code_of_conduct_nametextName of the Code of Conduct for the repository.
code_of_conduct_urltextURL of the Code of Conduct for the repository.
collaborator_loginsjsonbAn array of logins for users (inside and outside collaborators) who have access to the repository.
collaboratorsjsonbAn array of users (teams and outside collaborators) who have access to the repository, including their permissions.
created_attimestamp without time zoneThe timestamp when the repository was created.
default_branchtextThe name of the deafult branch. The default branch is the base branch for pull requests and code commits.
delete_branch_on_mergebooleanIf enabled, branches are automatically deleted whe a PR is merged.
descriptiontextThe repository description.
disabledbooleanIf true, the repository is disabled.
forkbooleanIf true, this repository is a fork of another repository.
forks_countbigintThe number of repositories that have forked this repository.
full_nametextThe full name of the repository, including the owner and repo name.
git_urltextThe git url to clone this repo via the git protocol.
has_downloadsbooleanIf true, the GitHub Downloads feature is enabled on the repository.
has_issuesbooleanIf true, the GitHub Issues feature is enabled on the repository.
has_pagesbooleanIf true, the GitHub Pages feature is enabled on the repository.
has_projectsbooleanIf true, the GitHub Projects feature is enabled on the repository.
has_wikibooleanIf true, the GitHub Wiki feature is enabled on the repository.
homepagetextThe URL of a page describing the project.
html_urltextThe URL of the repo.
idbigintThe unique ID number of the repository.
is_templatebooleanIf true, the repository is a template repository.
languagetextThe repository language (JavaScript, Go, etc)
license_keytextThe key of the license associated with the repository.
license_nametextThe name of the license associated with the repository.
license_node_idtextThe node id of the license associated with the repository.
license_spdx_idtextThe Software Package Data Exchange (SPDX) id of the license associated with the repository.
license_urltextThe url of the license associated with the repository.
nametextThe name of the repository.
network_countbigintThe number of member repositories in the network.
node_idtextThe Node ID of the repository.
open_issues_countbigintThe number of open issues for the repository.
outside_collaborator_loginsjsonbAn array of logins for outside collaborators who have access to the repository.
outside_collaboratorsjsonbAn array of outside collaborators who have access to the repository, including their permissions.
owner_idbigintThe user id (number) of the repository owner.
owner_logintextThe user login name of the repository owner.
owner_typetextThe type of the repository owner (User or Organization).
privatebooleanIf true, the repo is private, otherwise it is public.
pushed_attimestamp without time zoneTimestamp of the last push to the repository.
sizebigintThe size of the whole repository (including history), in kilobytes.
ssh_urltextThe url to clone this repo via ssh.
stargazers_countbigintThe number of users who have 'starred' the repository.
subscribers_countbigintThe number of users who have subscribed to the repository.
template_repositorytextThe template repository used to create this resource.
topicsjsonbThe topics (similar to tags or labels) associated with the repository.
updated_attimestamp without time zoneTimestamp when the repository was last updated.
urltextThe url to clone this repo via https.
visibilitytextThe visibility of the repository (public or private)
watchers_countbigintThe number of users who have watched the repository.