Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ internal async static Task ProtectDefaultBranch(this IGitHubClient client, Repos
true,
true,
true,
true,
false,
true);

Expand All @@ -55,6 +56,8 @@ internal async static Task<RepositoryContext> CreateRepositoryWithProtectedBranc
true,
true,
true,
true,
true,
false,
true);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -191,6 +191,7 @@ public async Task UpdatesBranchProtectionForOrgRepo()
new BranchProtectionRequiredStatusChecksUpdate(false, new[] { "new" }),
new BranchProtectionRequiredReviewsUpdate(new BranchProtectionRequiredReviewsDismissalRestrictionsUpdate(false), false, false, 2),
new BranchProtectionPushRestrictionsUpdate(),
true,
false,
true,
true,
Expand All @@ -211,6 +212,7 @@ public async Task UpdatesBranchProtectionForOrgRepo()
Assert.Empty(protection.Restrictions.Teams);
Assert.Empty(protection.Restrictions.Users);

Assert.True(protection.RequiredSignatures.Enabled);
Assert.False(protection.EnforceAdmins.Enabled);
Assert.True(protection.RequiredLinearHistory.Enabled);
Assert.True(protection.AllowForcePushes.Enabled);
Expand All @@ -230,6 +232,7 @@ public async Task UpdatesBranchProtectionForOrgRepoWithRepositoryId()
new BranchProtectionRequiredStatusChecksUpdate(false, new[] { "new" }),
new BranchProtectionRequiredReviewsUpdate(new BranchProtectionRequiredReviewsDismissalRestrictionsUpdate(false), false, false, 2),
new BranchProtectionPushRestrictionsUpdate(),
true,
false,
true,
true,
Expand All @@ -250,6 +253,7 @@ public async Task UpdatesBranchProtectionForOrgRepoWithRepositoryId()
Assert.Empty(protection.Restrictions.Teams);
Assert.Empty(protection.Restrictions.Users);

Assert.True(protection.RequiredSignatures.Enabled);
Assert.False(protection.EnforceAdmins.Enabled);
Assert.True(protection.RequiredLinearHistory.Enabled);
Assert.True(protection.AllowForcePushes.Enabled);
Expand Down
8 changes: 8 additions & 0 deletions Octokit/Models/Request/BranchProtectionUpdate.cs
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,7 @@ public BranchProtectionSettingsUpdate(BranchProtectionRequiredStatusChecksUpdate
/// <param name="requiredStatusChecks">Specifies the requested status check settings. Pass null to disable status checks</param>
/// <param name="requiredPullRequestReviews">Specifies if reviews are required to merge the pull request. Pass null to disable required reviews</param>
/// <param name="restrictions">Specifies the requested push access restrictions (applies only to Organization owned repositories). Pass null to disable push access restrictions</param>
/// <param name="requiredSignatures">Specifies whether commits to a branch are required to be signed by gpg keys</param>
/// <param name="enforceAdmins">Specifies whether the protections applied to this branch also apply to repository admins</param>
/// <param name="requiredLinearHistory">Enforces a linear commit Git history</param>
/// <param name="allowForcePushes">Permits force pushes to the protected branch</param>
Expand All @@ -122,6 +123,7 @@ public BranchProtectionSettingsUpdate(BranchProtectionRequiredStatusChecksUpdate
public BranchProtectionSettingsUpdate(BranchProtectionRequiredStatusChecksUpdate requiredStatusChecks,
BranchProtectionRequiredReviewsUpdate requiredPullRequestReviews,
BranchProtectionPushRestrictionsUpdate restrictions,
bool requiredSignatures,
bool enforceAdmins,
bool requiredLinearHistory,
bool? allowForcePushes,
Expand All @@ -133,6 +135,7 @@ public BranchProtectionSettingsUpdate(BranchProtectionRequiredStatusChecksUpdate
RequiredStatusChecks = requiredStatusChecks;
RequiredPullRequestReviews = requiredPullRequestReviews;
Restrictions = restrictions;
RequiredSignatures = requiredSignatures;
EnforceAdmins = enforceAdmins;
LockBranch = lockBranch;
RequiredLinearHistory = requiredLinearHistory;
Expand All @@ -159,6 +162,11 @@ public BranchProtectionSettingsUpdate(BranchProtectionRequiredStatusChecksUpdate
/// </summary>
[SerializeNull]
public BranchProtectionPushRestrictionsUpdate Restrictions { get; protected set; }

/// <summary>
/// Specifies whether the signed commits are required for this branch
/// </summary>
public bool RequiredSignatures { get; set; }

/// <summary>
/// Specifies whether the protections applied to this branch also apply to repository admins
Expand Down