Branch protection is a set of rules protecting the branch from inappropriate changes.
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
List branches and their protection for a repository
select*fromgithub_branch_protectionwhererepository_full_name = 'turbot/steampipe'
Get branch protection for a specific repo
select*fromgithub_branch_protectionwhererepository_full_name = 'turbot/steampipe'and name = 'main'
Branch protection defines rules for pushing to and managing a branch.
|allow_deletions_enabled||boolean||If true, allow users with push access to delete matching branches.|
|allow_force_pushes_enabled||boolean||If true, permit force pushes for all users with push access.|
|enforce_admins_enabled||boolean||If true, enforce all configured restrictions for administrators.|
|name||text||The branch name.|
|repository_full_name||text||The full name of the repository (login/repo-name).|
|required_linear_history_enabled||boolean||If true, prevent merge commits from being pushed to matching branches.|
|required_pull_request_reviews||jsonb||Pull request reviews required before merging.|
|required_status_checks||jsonb||Status checks that must pass before a branch can be merged into branches matching this rule.|
|restrictions_apps||jsonb||Applications can push to the branch only if in this list.|
|restrictions_teams||jsonb||Teams can push to the branch only if in this list.|
|restrictions_users||jsonb||Users can push to the branch only if in this list.|