Skip to content

Commit ee9f8fa

Browse files
authored
Merge pull request #1904 from Turbo87/fix-required-approvals
validate: Fix `pr-required = false` validation for `required-approvals = 0`
2 parents cdb6b2c + 6b9bcf5 commit ee9f8fa

File tree

1 file changed

+8
-6
lines changed

1 file changed

+8
-6
lines changed

src/validate.rs

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -949,12 +949,14 @@ but that team is not mentioned in [access.teams]"#,
949949
protection.pattern,
950950
);
951951
}
952-
if protection.required_approvals.is_some() {
953-
bail!(
954-
r#"repo '{}' uses a branch protection for {} that does not require a PR, but sets the `required-approvals` attribute"#,
955-
repo.name,
956-
protection.pattern,
957-
);
952+
if let Some(required_approvals) = protection.required_approvals {
953+
if required_approvals > 0 {
954+
bail!(
955+
r#"repo '{}' uses a branch protection for {} that does not require a PR, but `required-approvals` is greater than 0"#,
956+
repo.name,
957+
protection.pattern,
958+
);
959+
}
958960
}
959961
}
960962

0 commit comments

Comments
 (0)