Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
26807458dc | ||
|
|
703ee0fb87 |
@@ -64,12 +64,16 @@ public class App : IApp
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
var isCodeFreezePeriod = _settings.ReleaseCodeFreeze != "true";
|
var isCodeFreezePeriod = _settings.ReleaseCodeFreeze == "true";
|
||||||
var periodDescription = isCodeFreezePeriod ? "Code-Freeze. Restrictions may apply" : "Normal";
|
var periodDescription = isCodeFreezePeriod ? "Code-Freeze. Restrictions may apply" : "Normal";
|
||||||
Console.WriteLine($"Current period is {periodDescription}.");
|
Console.WriteLine($"Current period is {periodDescription}.");
|
||||||
|
|
||||||
approversDict = FilterApprovers(approversDict, isCodeFreezePeriod);
|
var filtered = FilterApprovers(approversDict, isCodeFreezePeriod);
|
||||||
if (!await IsApproved(mergeRequest, commit, approversDict))
|
if (!filtered.Any() && isCodeFreezePeriod)
|
||||||
|
{
|
||||||
|
filtered = FilterApprovers(approversDict, false);
|
||||||
|
}
|
||||||
|
if (!await IsApproved(mergeRequest, commit, filtered))
|
||||||
{
|
{
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ namespace Approve.Checker.Gitlab;
|
|||||||
|
|
||||||
public class ApproversDto
|
public class ApproversDto
|
||||||
{
|
{
|
||||||
public bool? ForCodeFreeze { get; set; }
|
public bool ForCodeFreeze { get; set; }
|
||||||
public int CountApprovers { get; set; } = 1;
|
public int CountApprovers { get; set; } = 1;
|
||||||
public List<string> Users { get; set; } = new();
|
public List<string> Users { get; set; } = new();
|
||||||
}
|
}
|
||||||
@@ -7,10 +7,10 @@ using Newtonsoft.Json;
|
|||||||
|
|
||||||
#pragma warning disable CS8618
|
#pragma warning disable CS8618
|
||||||
|
|
||||||
namespace Approve.Checker.Gitlab.Dto
|
namespace Approve.Checker.Gitlab.Dto;
|
||||||
|
|
||||||
|
public sealed class CustomMergeRequest
|
||||||
{
|
{
|
||||||
public sealed class CustomMergeRequest
|
|
||||||
{
|
|
||||||
[JsonProperty("iid")]
|
[JsonProperty("iid")]
|
||||||
public int Iid { get; set; }
|
public int Iid { get; set; }
|
||||||
|
|
||||||
@@ -106,5 +106,4 @@ namespace Approve.Checker.Gitlab.Dto
|
|||||||
|
|
||||||
[JsonProperty("merged_by")]
|
[JsonProperty("merged_by")]
|
||||||
public Assignee MergedBy { get; set; }
|
public Assignee MergedBy { get; set; }
|
||||||
}
|
|
||||||
}
|
}
|
||||||
@@ -1,7 +1,7 @@
|
|||||||
namespace Approve.Checker.Gitlab
|
namespace Approve.Checker.Gitlab;
|
||||||
|
|
||||||
|
public class Settings
|
||||||
{
|
{
|
||||||
public class Settings
|
|
||||||
{
|
|
||||||
public string GitlabUrl = Environment.GetEnvironmentVariable("CI_SERVER_URL") ?? CheckAndThrow("CI_SERVER_URL");
|
public string GitlabUrl = Environment.GetEnvironmentVariable("CI_SERVER_URL") ?? CheckAndThrow("CI_SERVER_URL");
|
||||||
public string GitlabToken = Environment.GetEnvironmentVariable("GITLAB_TOKEN") ?? CheckAndThrow("GITLAB_TOKEN");
|
public string GitlabToken = Environment.GetEnvironmentVariable("GITLAB_TOKEN") ?? CheckAndThrow("GITLAB_TOKEN");
|
||||||
public string MrPath = Environment.GetEnvironmentVariable("CI_OPEN_MERGE_REQUESTS")!;
|
public string MrPath = Environment.GetEnvironmentVariable("CI_OPEN_MERGE_REQUESTS")!;
|
||||||
@@ -14,5 +14,4 @@
|
|||||||
Console.WriteLine($"Please define {name}");
|
Console.WriteLine($"Please define {name}");
|
||||||
throw new ArgumentException($"Please define {name}");
|
throw new ArgumentException($"Please define {name}");
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user