turbot/github_compliance
GitHub

Query: default_branch_requires_2_pull_request_reviews

Usage

steampipe query github_compliance.query.default_branch_requires_2_pull_request_reviews

Plugins & Tables

SQL

select
-- Required Columns
url as resource,
case
when (default_branch_ref -> 'branch_protection_rule') is null then 'info'
when (default_branch_ref -> 'branch_protection_rule') is not null
and (
default_branch_ref -> 'branch_protection_rule' ->> 'required_approving_review_count'
) :: integer >= 2 then 'ok'
else 'alarm'
end as status,
name_with_owner || ' default branch ' || (default_branch_ref ->> 'name') || case
when (default_branch_ref -> 'branch_protection_rule') is null then ' branch protection rule unknown.'
when (
default_branch_ref -> 'branch_protection_rule' ->> 'required_approving_review_count'
) :: integer >= 2 then ' has at least two pull request reviews.'
else ' does not have at least two pull request reviews.'
end as reason,
-- Additional Dimensions
name_with_owner
from
github_my_repository;

Controls

The query is being used by the following controls: