mirror of
https://github.com/zoriya/octokit.net.git
synced 2026-06-02 10:55:53 +00:00
Add BranchProtection.EnforceAdmins object (#1598)
* Add BranchProtection.EnforceAdmins object * Add EnforceAdmin related methods to RepoBranch clients * Add unit tests * Add unit tests for Observable client * Add integration tests for enforce admin methods * Tweak integration test to ensure that they actually do something The `CreateRepositoryWithProtectedBranch` helper method currently sets `EnforceAdmins` as true, so delete it before adding. * add missing docs * rename tests * Add missing ctor * Remove property that is no longer supported https://developer.github.com/changes/2017-05-02-adoption-of-admin-enforced/ * Fix failing unit tests
This commit is contained in:
committed by
Ryan Gribble
parent
73feecefb3
commit
58ba2eccf9
@@ -78,7 +78,7 @@ namespace Octokit
|
||||
/// <summary>
|
||||
/// The enforcement levels that are available
|
||||
/// </summary>
|
||||
[Obsolete("This existing implementation will cease to work when the Branch Protection API preview period ends. Please see BranchProtectionRequiredStatusChecks.IncludeAdmins instead.")]
|
||||
[Obsolete("This existing implementation will cease to work when the Branch Protection API preview period ends. Please see BranchProtection.EnforceAdmins instead.")]
|
||||
public enum EnforcementLevel
|
||||
{
|
||||
/// <summary>
|
||||
@@ -134,6 +134,28 @@ namespace Octokit
|
||||
Restrictions == null ? "disabled" : Restrictions.DebuggerDisplay);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Specifies whether the protections applied to this branch also apply to repository admins
|
||||
/// </summary>
|
||||
public EnforceAdmins EnforceAdmins { get; protected set; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Specifies whether the protections applied to this branch also apply to repository admins
|
||||
/// </summary>
|
||||
[DebuggerDisplay("{DebuggerDisplay,nq}")]
|
||||
public class EnforceAdmins
|
||||
{
|
||||
public bool Enabled { get; protected set; }
|
||||
|
||||
internal string DebuggerDisplay
|
||||
{
|
||||
get
|
||||
{
|
||||
return string.Format(CultureInfo.InvariantCulture, "Enabled: {0}", Enabled);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -144,18 +166,12 @@ namespace Octokit
|
||||
{
|
||||
public BranchProtectionRequiredStatusChecks() { }
|
||||
|
||||
public BranchProtectionRequiredStatusChecks(bool includeAdmins, bool strict, IReadOnlyList<string> contexts)
|
||||
public BranchProtectionRequiredStatusChecks(bool strict, IReadOnlyList<string> contexts)
|
||||
{
|
||||
IncludeAdmins = includeAdmins;
|
||||
Strict = strict;
|
||||
Contexts = contexts;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Enforce required status checks for repository administrators
|
||||
/// </summary>
|
||||
public bool IncludeAdmins { get; protected set; }
|
||||
|
||||
/// <summary>
|
||||
/// Require branches to be up to date before merging
|
||||
/// </summary>
|
||||
@@ -171,10 +187,9 @@ namespace Octokit
|
||||
get
|
||||
{
|
||||
return string.Format(CultureInfo.InvariantCulture,
|
||||
"IncludeAdmins: {0} Strict: {1} Contexts: {2}",
|
||||
IncludeAdmins,
|
||||
"Strict: {0} Contexts: {1}",
|
||||
Strict,
|
||||
Contexts == null ? "" : String.Join(",", Contexts));
|
||||
Contexts == null ? "" : string.Join(",", Contexts));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user