Table: github_team_repository - Query GitHub Teams Repositories using SQL
GitHub Teams Repositories represent the association between teams and repositories within a GitHub organization. Teams are groups of organization members that reflect the company or project structure in your organization. Repositories are where all your project files (including documentation) reside and teams can be granted access to these repositories.
Table Usage Guide
The github_team_repository
table provides insights into the association between teams and repositories within a GitHub organization. As a project manager or team lead, explore team-specific access details through this table, including repository permissions and associated metadata. Utilize it to uncover information about team access to repositories, such as those with admin permissions, the relationship between teams and repositories, and the verification of access policies.
Important Notes
- You must specify the
organization
andslug
columns in thewhere
orjoin
clause to query the table. - To list all your repositories use the
github_my_repository
table instead. To get information about any repository, use thegithub_repository
table instead.
Examples
List a specific team's repositories
This query is designed to help you gain insights into the details of a specific team's repositories within your organization on GitHub. It is useful for understanding the team's repository permissions, primary language, fork count, stargazer count, license information, and other relevant details, which can help in managing team resources and identifying areas for improvement.
select organization, slug as team_slug, name as team_name, permission, primary_language ->> 'name' as language, fork_count, stargazer_count, license_info ->> 'spdx_id' as license, description, urlfrom github_team_repositorywhere organization = 'my_org' and slug = 'my-team';
select organization, slug as team_slug, name as team_name, permission, (primary_language ->> 'name') as language, fork_count, stargazer_count, (license_info ->> 'spdx_id') as license, description, urlfrom github_team_repositorywhere organization = 'my_org' and slug = 'my-team';
List visible teams and repositories they have admin permissions to
Explore the teams and associated repositories within your organization that have administrative permissions. This is useful to ensure appropriate access rights and maintain security within your GitHub organization.
select organization, slug as team_slug, name as name, description, permission, is_fork, is_private, is_archived, primary_language ->> 'name' as languagefrom github_team_repositorywhere organization = 'my_org' and slug = 'my-team' and permission = 'ADMIN';
select organization, slug as team_slug, name as name, description, permission, is_fork, is_private, is_archived, json_extract(primary_language, '$.name') as languagefrom github_team_repositorywhere organization = 'my_org' and slug = 'my-team' and permission = 'ADMIN';
Schema for github_team_repository
Name | Type | Operators | Description |
---|---|---|---|
_ctx | jsonb | Steampipe context in JSON form. | |
allow_update_branch | boolean | If true, a pull request head branch that is behind its base branch can always be updated even if it is not required to be up to date before merging. | |
archived_at | timestamp with time zone | Timestamp when repository was archived. | |
auto_merge_allowed | boolean | If true, auto-merge can be enabled on pull requests in this repository. | |
can_administer | boolean | If true, you can administer this repository. | |
can_create_projects | boolean | If true, you can create projects in this repository. | |
can_subscribe | boolean | If true, you can subscribe to this repository. | |
can_update_topics | boolean | If true, you can update topics on this repository. | |
code_of_conduct | jsonb | The code of conduct for this repository. | |
contact_links | jsonb | List of contact links associated to the repository. | |
created_at | timestamp with time zone | Timestamp when the repository was created. | |
default_branch_ref | jsonb | Default ref information. | |
delete_branch_on_merge | boolean | If true, branches are automatically deleted when merged in this repository. | |
description | text | The description of the repository. | |
disk_usage | bigint | Number of kilobytes this repository occupies on disk. | |
fork_count | bigint | Number of forks there are of this repository in the whole network. | |
forking_allowed | boolean | If true, repository allows forks. | |
funding_links | jsonb | The funding links for this repository. | |
has_discussions_enabled | boolean | If true, the repository has the Discussions feature enabled. | |
has_downloads | boolean | If true, the GitHub Downloads feature is enabled on the repository. | |
has_issues_enabled | boolean | If true, the repository has issues feature enabled. | |
has_pages | boolean | If true, the GitHub Pages feature is enabled on the repository. | |
has_projects_enabled | boolean | If true, the repository has the Projects feature enabled. | |
has_starred | boolean | If true, you have starred this repository. | |
has_vulnerability_alerts_enabled | boolean | If true, vulnerability alerts are enabled for the repository. | |
has_wiki_enabled | boolean | If true, the repository has wiki feature enabled. | |
homepage_url | text | The external URL of the repository if set. | |
hooks | jsonb | The API Hooks URL. | |
id | bigint | The numeric ID of the repository. | |
interaction_ability | jsonb | The interaction ability settings for this repository. | |
is_archived | boolean | If true, the repository is unmaintained (archived). | |
is_blank_issues_enabled | boolean | If true, blank issue creation is allowed. | |
is_disabled | boolean | If true, this repository disabled. | |
is_empty | boolean | If true, this repository is empty. | |
is_fork | boolean | If true, the repository is a fork. | |
is_in_organization | boolean | If true, repository is either owned by an organization, or is a private fork of an organization repository. | |
is_locked | boolean | If true, repository is locked. | |
is_mirror | boolean | If true, the repository is a mirror. | |
is_private | boolean | If true, the repository is private or internal. | |
is_security_policy_enabled | boolean | If true, repository has a security policy. | |
is_template | boolean | If true, the repository is a template that can be used to generate new repositories. | |
is_user_configuration_repository | boolean | If true, this is a user configuration repository. | |
issue_templates | jsonb | A list of issue templates associated to the repository. | |
license_info | jsonb | The license associated with the repository. | |
lock_reason | text | The reason the repository has been locked. | |
login_id | text | =, !=, ~~, ~~*, !~~, !~~* | Unique identifier for the user login. |
merge_commit_allowed | boolean | If true, PRs are merged with a merge commit on this repository. | |
merge_commit_message | text | How the default commit message will be generated when merging a pull request. | |
merge_commit_title | text | How the default commit title will be generated when merging a pull request. | |
mirror_url | text | The repository's original mirror URL. | |
name | text | = | The name of the repository. |
name_with_owner | text | The repository's name with owner. | |
network_count | bigint | The number of member repositories in the network. | |
node_id | text | The node ID of the repository. | |
open_graph_image_url | text | The image used to represent this repository in Open Graph data. | |
open_issues_total_count | bigint | Count of issues open on the repository. | |
organization | text | = | The organization the team is associated with. |
owner_login | text | Login of the repository owner. | |
permission | text | The permission level the team has on the repository. | |
possible_commit_emails | jsonb | A list of emails you can commit to this repository with. | |
primary_language | jsonb | The primary language of the repository's code. | |
projects_url | text | The URL listing the repository's projects. | |
pull_request_templates | jsonb | Returns a list of pull request templates associated to the repository. | |
pushed_at | timestamp with time zone | Timestamp when the repository was last pushed to. | |
rebase_merge_allowed | boolean | If true, rebase-merging is enabled on this repository. | |
repository_topics_total_count | bigint | Count of topics associated with the repository. | |
security_policy_url | text | The security policy URL. | |
slug | text | = | The team slug name. |
sp_connection_name | text | =, !=, ~~, ~~*, !~~, !~~* | Steampipe connection name. |
sp_ctx | jsonb | Steampipe context in JSON form. | |
squash_merge_allowed | boolean | If true, squash-merging is enabled on this repository. | |
squash_merge_commit_message | text | How the default commit message will be generated when squash merging a pull request. | |
squash_merge_commit_title | text | How the default commit title will be generated when squash merging a pull request. | |
ssh_url | text | The SSH URL to clone this repository. | |
stargazer_count | bigint | Returns a count of how many stargazers there are on this repository. | |
subscribers_count | bigint | The number of users who have subscribed to the repository. | |
subscription | text | Identifies if the current user is watching, not watching, or ignoring the repository. | |
topics | jsonb | The topics (similar to tags or labels) associated with the repository. | |
updated_at | timestamp with time zone | Timestamp when repository was last updated. | |
url | text | The URL of the repository. | |
uses_custom_open_graph_image | boolean | if true, this repository has a custom image to use with Open Graph as opposed to being represented by the owner's avatar. | |
visibility | text | Indicates the repository's visibility level. | |
watchers_total_count | bigint | Count of watchers on the repository. | |
web_commit_signoff_required | boolean | If true, contributors are required to sign off on web-based commits in this repository. | |
your_permission | text | Your permission level on the repository. Will return null if authenticated as an GitHub App. |
Export
This table is available as a standalone Exporter CLI. Steampipe exporters are stand-alone binaries that allow you to extract data using Steampipe plugins without a database.
You can download the tarball for your platform from the Releases page, but it is simplest to install them with the steampipe_export_installer.sh
script:
/bin/sh -c "$(curl -fsSL https://steampipe.io/install/export.sh)" -- github
You can pass the configuration to the command with the --config
argument:
steampipe_export_github --config '<your_config>' github_team_repository