turbot/github

GitHub
steampipe plugin install githubsteampipe plugin install github

Table: github_branch_protection

Branch protection is a set of rules protecting the branch from inappropriate changes.

The github_branch_protection table can be used to query information about any branch, and you must specify which repository in the where or join clause using the repository_full_name column.

GitHub users with admin permissions to a repository can manage branch protection rules.

Examples

List branches and their protection for a repository

select
*
from
github_branch_protection
where
repository_full_name = 'turbot/steampipe';

Get branch protection for a specific repo

select
*
from
github_branch_protection
where
repository_full_name = 'turbot/steampipe'
and name = 'main';

Control examples

.inspect github_branch_protection

Branch protection defines rules for pushing to and managing a branch.

NameTypeDescription
_ctxjsonbSteampipe context in JSON form, e.g. connection_name.
allow_deletions_enabledbooleanIf true, allow users with push access to delete matching branches.
allow_force_pushes_enabledbooleanIf true, permit force pushes for all users with push access.
enforce_admins_enabledbooleanIf true, enforce all configured restrictions for administrators.
nametextThe branch name.
repository_full_nametextThe full name of the repository (login/repo-name).
required_linear_history_enabledbooleanIf true, prevent merge commits from being pushed to matching branches.
required_pull_request_reviewsjsonbPull request reviews required before merging.
required_status_checksjsonbStatus checks that must pass before a branch can be merged into branches matching this rule.
restrictions_appsjsonbApplications can push to the branch only if in this list.
restrictions_teamsjsonbTeams can push to the branch only if in this list.
restrictions_usersjsonbUsers can push to the branch only if in this list.