turbot/github_insights

Query: default_branch_protection_table

Usage

powerpipe query github_insights.query.default_branch_protection_table

Steampipe Tables

SQL

select
name_with_owner as "Repository",
(default_branch_ref ->> 'name') as "Default Branch",
case
when (default_branch_ref -> 'branch_protection_rule') is null then 'Unknown - manual check required'
else 'Protected'
end as "Protection Status",
(default_branch_ref -> 'branch_protection_rule' ->> 'restricts_pushes')::bool as "Restricts Pushes",
(default_branch_ref -> 'branch_protection_rule' ->> 'allows_force_pushes')::bool as "Allows Force Pushes",
(default_branch_ref -> 'branch_protection_rule' ->> 'allows_deletions')::bool as "Allows Deletions",
(default_branch_ref -> 'branch_protection_rule' ->> 'requires_approving_reviews')::bool as "Requires Approvals",
(default_branch_ref -> 'branch_protection_rule' ->> 'requires_conversation_resolution')::bool as "Requires Conversation Resolution",
(default_branch_ref -> 'branch_protection_rule' ->> 'requires_commit_signatures')::bool as "Requires Signed Commits",
(default_branch_ref -> 'branch_protection_rule' ->> 'requires_linear_history')::bool as "Requires Linear History",
(default_branch_ref -> 'branch_protection_rule' ->> 'is_admin_enforced')::bool as "Applies to Admins",
url
from
github_my_repository
order by
name_with_owner;

Dashboards

The query is used in the dashboards: