Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix: Add RequiredSignatures to the BranchProtectionSettingsUpdate Type #2873

Merged
merged 2 commits into from
Feb 5, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
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
7 changes: 7 additions & 0 deletions Octokit/Models/Request/BranchProtectionUpdate.cs
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,7 @@
public BranchProtectionSettingsUpdate(BranchProtectionRequiredStatusChecksUpdate requiredStatusChecks,
BranchProtectionRequiredReviewsUpdate requiredPullRequestReviews,
BranchProtectionPushRestrictionsUpdate restrictions,
bool requiredSignatures,

Check warning on line 125 in Octokit/Models/Request/BranchProtectionUpdate.cs

View workflow job for this annotation

GitHub Actions / build (ubuntu-latest)

Parameter 'requiredSignatures' has no matching param tag in the XML comment for 'BranchProtectionSettingsUpdate.BranchProtectionSettingsUpdate(BranchProtectionRequiredStatusChecksUpdate, BranchProtectionRequiredReviewsUpdate, BranchProtectionPushRestrictionsUpdate, bool, bool, bool, bool?, bool, bool, bool, bool)' (but other parameters do)

Check warning on line 125 in Octokit/Models/Request/BranchProtectionUpdate.cs

View workflow job for this annotation

GitHub Actions / build (macos-latest)

Parameter 'requiredSignatures' has no matching param tag in the XML comment for 'BranchProtectionSettingsUpdate.BranchProtectionSettingsUpdate(BranchProtectionRequiredStatusChecksUpdate, BranchProtectionRequiredReviewsUpdate, BranchProtectionPushRestrictionsUpdate, bool, bool, bool, bool?, bool, bool, bool, bool)' (but other parameters do)

Check warning on line 125 in Octokit/Models/Request/BranchProtectionUpdate.cs

View workflow job for this annotation

GitHub Actions / build (windows-latest)

Parameter 'requiredSignatures' has no matching param tag in the XML comment for 'BranchProtectionSettingsUpdate.BranchProtectionSettingsUpdate(BranchProtectionRequiredStatusChecksUpdate, BranchProtectionRequiredReviewsUpdate, BranchProtectionPushRestrictionsUpdate, bool, bool, bool, bool?, bool, bool, bool, bool)' (but other parameters do)
wesdevpro marked this conversation as resolved.
Show resolved Hide resolved
bool enforceAdmins,
bool requiredLinearHistory,
bool? allowForcePushes,
Expand All @@ -133,6 +134,7 @@
RequiredStatusChecks = requiredStatusChecks;
RequiredPullRequestReviews = requiredPullRequestReviews;
Restrictions = restrictions;
RequiredSignatures = requiredSignatures;
EnforceAdmins = enforceAdmins;
LockBranch = lockBranch;
RequiredLinearHistory = requiredLinearHistory;
Expand All @@ -159,6 +161,11 @@
/// </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