[FEAT] Add support for "Require approval of the most recent reviewable push" (#2839)

Add support for "Require approval of the most recent reviewable push"

Co-authored-by: Nick Floyd <139819+nickfloyd@users.noreply.github.com>
This commit is contained in:
Chris
2024-01-03 16:42:22 +00:00
committed by GitHub
parent 3e92a697b4
commit b1a2cf52ed
4 changed files with 45 additions and 10 deletions
@@ -28,7 +28,7 @@ namespace Octokit.Tests.Integration.Helpers
// Protect default branch
var update = new BranchProtectionSettingsUpdate(
new BranchProtectionRequiredStatusChecksUpdate(true, new[] { "build", "test" }),
new BranchProtectionRequiredReviewsUpdate(true, true, 3),
new BranchProtectionRequiredReviewsUpdate(true, true, 3, true),
null,
true,
true,
@@ -78,7 +78,7 @@ namespace Octokit.Tests.Integration.Helpers
// Protect default branch
var protection = new BranchProtectionSettingsUpdate(
new BranchProtectionRequiredStatusChecksUpdate(true, new[] { "build", "test" }),
new BranchProtectionRequiredReviewsUpdate(new BranchProtectionRequiredReviewsDismissalRestrictionsUpdate(new BranchProtectionTeamCollection { team.TeamName }), true, true, 3),
new BranchProtectionRequiredReviewsUpdate(new BranchProtectionRequiredReviewsDismissalRestrictionsUpdate(new BranchProtectionTeamCollection { team.TeamName }), true, true, 3, true),
new BranchProtectionPushRestrictionsUpdate(new BranchProtectionTeamCollection { team.TeamName }),
true);
await client.Repository.Branch.UpdateBranchProtection(repoContext.RepositoryOwner, repoContext.RepositoryName, repoContext.RepositoryDefaultBranch, protection);
@@ -105,7 +105,7 @@ namespace Octokit.Tests.Integration.Helpers
// Protect default branch
var protection = new BranchProtectionSettingsUpdate(
new BranchProtectionRequiredStatusChecksUpdate(true, new[] { "build", "test" }),
new BranchProtectionRequiredReviewsUpdate(new BranchProtectionRequiredReviewsDismissalRestrictionsUpdate(new BranchProtectionTeamCollection { contextOrgTeam.TeamName }), true, true, 3),
new BranchProtectionRequiredReviewsUpdate(new BranchProtectionRequiredReviewsDismissalRestrictionsUpdate(new BranchProtectionTeamCollection { contextOrgTeam.TeamName }), true, true, 3, true),
new BranchProtectionPushRestrictionsUpdate(new BranchProtectionTeamCollection { contextOrgTeam.TeamName }),
true);
await client.Repository.Branch.UpdateBranchProtection(contextOrgRepo.RepositoryOwner, contextOrgRepo.RepositoryName, "main", protection);