Fix: Add RequiredSignatures to the BranchProtectionSettingsUpdate Type (#2873)

* fix: added `RequiredSignatures` to the `BranchProtectionSettingsUpdate` types.

- Fixes #2855
- Updated `BranchProtectionSettingsUpdate` by adding `RequiredSignatures`.
- Update all integration `xUnit` tests to check for the `RequiredSignatures` property.

* docs: add comment documenting the `RequiredSignatures` property
This commit is contained in:
Wesley Ford
2024-02-05 15:37:25 -06:00
committed by GitHub
parent 39d689651f
commit 350b8fe830
3 changed files with 15 additions and 0 deletions

View File

@@ -34,6 +34,7 @@ namespace Octokit.Tests.Integration.Helpers
true, true,
true, true,
true, true,
true,
false, false,
true); true);
@@ -55,6 +56,8 @@ namespace Octokit.Tests.Integration.Helpers
true, true,
true, true,
true, true,
true,
true,
false, false,
true); true);

View File

@@ -191,6 +191,7 @@ namespace Octokit.Tests.Integration.Reactive
new BranchProtectionRequiredStatusChecksUpdate(false, new[] { "new" }), new BranchProtectionRequiredStatusChecksUpdate(false, new[] { "new" }),
new BranchProtectionRequiredReviewsUpdate(new BranchProtectionRequiredReviewsDismissalRestrictionsUpdate(false), false, false, 2), new BranchProtectionRequiredReviewsUpdate(new BranchProtectionRequiredReviewsDismissalRestrictionsUpdate(false), false, false, 2),
new BranchProtectionPushRestrictionsUpdate(), new BranchProtectionPushRestrictionsUpdate(),
true,
false, false,
true, true,
true, true,
@@ -211,6 +212,7 @@ namespace Octokit.Tests.Integration.Reactive
Assert.Empty(protection.Restrictions.Teams); Assert.Empty(protection.Restrictions.Teams);
Assert.Empty(protection.Restrictions.Users); Assert.Empty(protection.Restrictions.Users);
Assert.True(protection.RequiredSignatures.Enabled);
Assert.False(protection.EnforceAdmins.Enabled); Assert.False(protection.EnforceAdmins.Enabled);
Assert.True(protection.RequiredLinearHistory.Enabled); Assert.True(protection.RequiredLinearHistory.Enabled);
Assert.True(protection.AllowForcePushes.Enabled); Assert.True(protection.AllowForcePushes.Enabled);
@@ -230,6 +232,7 @@ namespace Octokit.Tests.Integration.Reactive
new BranchProtectionRequiredStatusChecksUpdate(false, new[] { "new" }), new BranchProtectionRequiredStatusChecksUpdate(false, new[] { "new" }),
new BranchProtectionRequiredReviewsUpdate(new BranchProtectionRequiredReviewsDismissalRestrictionsUpdate(false), false, false, 2), new BranchProtectionRequiredReviewsUpdate(new BranchProtectionRequiredReviewsDismissalRestrictionsUpdate(false), false, false, 2),
new BranchProtectionPushRestrictionsUpdate(), new BranchProtectionPushRestrictionsUpdate(),
true,
false, false,
true, true,
true, true,
@@ -250,6 +253,7 @@ namespace Octokit.Tests.Integration.Reactive
Assert.Empty(protection.Restrictions.Teams); Assert.Empty(protection.Restrictions.Teams);
Assert.Empty(protection.Restrictions.Users); Assert.Empty(protection.Restrictions.Users);
Assert.True(protection.RequiredSignatures.Enabled);
Assert.False(protection.EnforceAdmins.Enabled); Assert.False(protection.EnforceAdmins.Enabled);
Assert.True(protection.RequiredLinearHistory.Enabled); Assert.True(protection.RequiredLinearHistory.Enabled);
Assert.True(protection.AllowForcePushes.Enabled); Assert.True(protection.AllowForcePushes.Enabled);

View File

@@ -112,6 +112,7 @@ namespace Octokit
/// <param name="requiredStatusChecks">Specifies the requested status check settings. Pass null to disable status checks</param> /// <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="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="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="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="requiredLinearHistory">Enforces a linear commit Git history</param>
/// <param name="allowForcePushes">Permits force pushes to the protected branch</param> /// <param name="allowForcePushes">Permits force pushes to the protected branch</param>
@@ -122,6 +123,7 @@ namespace Octokit
public BranchProtectionSettingsUpdate(BranchProtectionRequiredStatusChecksUpdate requiredStatusChecks, public BranchProtectionSettingsUpdate(BranchProtectionRequiredStatusChecksUpdate requiredStatusChecks,
BranchProtectionRequiredReviewsUpdate requiredPullRequestReviews, BranchProtectionRequiredReviewsUpdate requiredPullRequestReviews,
BranchProtectionPushRestrictionsUpdate restrictions, BranchProtectionPushRestrictionsUpdate restrictions,
bool requiredSignatures,
bool enforceAdmins, bool enforceAdmins,
bool requiredLinearHistory, bool requiredLinearHistory,
bool? allowForcePushes, bool? allowForcePushes,
@@ -133,6 +135,7 @@ namespace Octokit
RequiredStatusChecks = requiredStatusChecks; RequiredStatusChecks = requiredStatusChecks;
RequiredPullRequestReviews = requiredPullRequestReviews; RequiredPullRequestReviews = requiredPullRequestReviews;
Restrictions = restrictions; Restrictions = restrictions;
RequiredSignatures = requiredSignatures;
EnforceAdmins = enforceAdmins; EnforceAdmins = enforceAdmins;
LockBranch = lockBranch; LockBranch = lockBranch;
RequiredLinearHistory = requiredLinearHistory; RequiredLinearHistory = requiredLinearHistory;
@@ -159,6 +162,11 @@ namespace Octokit
/// </summary> /// </summary>
[SerializeNull] [SerializeNull]
public BranchProtectionPushRestrictionsUpdate Restrictions { get; protected set; } public BranchProtectionPushRestrictionsUpdate Restrictions { get; protected set; }
/// <summary>
/// Specifies whether the signed commits are required for this branch
/// </summary>
public bool RequiredSignatures { get; set; }
/// <summary> /// <summary>
/// Specifies whether the protections applied to this branch also apply to repository admins /// Specifies whether the protections applied to this branch also apply to repository admins