Skip to content

Commit

Permalink
Fix build
Browse files Browse the repository at this point in the history
React to breaking changes for `StringEnum<T>`.
  • Loading branch information
martincostello committed Jun 10, 2023
1 parent 895cc0e commit 3e552ca
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 7 deletions.
8 changes: 4 additions & 4 deletions src/Costellobot/Handlers/CheckSuiteHandler.cs
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ private bool IsCheckSuiteEligibleForRerun(CheckSuiteEvent body)
return false;
}

if (checkSuite.Conclusion != CheckSuiteConclusion.Failure)
if (checkSuite.Conclusion?.Value != CheckSuiteConclusion.Failure)
{
Log.IgnoringCheckRunThatDidNotFail(_logger, checkSuiteId, owner, name);
return false;
Expand Down Expand Up @@ -133,7 +133,7 @@ private async Task<bool> CanRerunCheckSuiteAsync(string owner, string name, long
});

var failedRuns = checkRuns.CheckRuns
.Where((p) => p.Conclusion == CheckConclusion.Failure)
.Where((p) => p.Conclusion?.Value == CheckConclusion.Failure)
.Where((p) => p.PullRequests.Count > 0)
.ToList();

Expand Down Expand Up @@ -178,8 +178,8 @@ private async Task<bool> CanRerunCheckSuiteAsync(string owner, string name, long

var latestFailingCheckRuns = latestCheckSuites.CheckRuns
.Where((p) => retryEligibleRuns.Any((group) => group.Key == p.Name))
.Where((p) => p.Status == CheckStatus.Completed)
.Where((p) => p.Conclusion == CheckConclusion.Failure)
.Where((p) => p.Status.Value == CheckStatus.Completed)
.Where((p) => p.Conclusion?.Value == CheckConclusion.Failure)
.ToList();

if (latestFailingCheckRuns.Count < 1)
Expand Down
4 changes: 2 additions & 2 deletions src/Costellobot/Handlers/DeploymentStatusHandler.cs
Original file line number Diff line number Diff line change
Expand Up @@ -144,14 +144,14 @@ private bool IsDeploymentWaitingForApproval(DeploymentStatusEvent message)
return false;
}

if (message.DeploymentStatus.State != DeploymentStatusState.Waiting)
if (message.DeploymentStatus.State.Value != DeploymentStatusState.Waiting)
{
Log.IgnoringDeploymentStatusAsNotWaiting(
_logger,
message.DeploymentStatus.Id,
message.Repository!.Owner.Login,
message.Repository.Name,
message.DeploymentStatus.State);
message.DeploymentStatus.State.Value);

return false;
}
Expand Down
2 changes: 1 addition & 1 deletion src/Costellobot/Handlers/PullRequestHandler.cs
Original file line number Diff line number Diff line change
Expand Up @@ -235,7 +235,7 @@ private async Task<bool> IsManuallyApprovedAsync(PullRequestEvent message)
if (message is not PullRequestLabeledEvent labelled ||
message.Repository is not { } repository ||
message.Sender is not { } sender ||
message.PullRequest.State != Octokit.Webhooks.Models.PullRequestEvent.PullRequestState.Open ||
message.PullRequest.State?.Value != Octokit.Webhooks.Models.PullRequestEvent.PullRequestState.Open ||
message.PullRequest.Draft)
{
return false;
Expand Down
3 changes: 3 additions & 0 deletions tests/Costellobot.Tests/Builders/PullRequestBuilder.cs
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,8 @@ public PullRequestBuilder(RepositoryBuilder repository, UserBuilder? user = null

public string ShaHead { get; set; } = RandomString();

public string State { get; set; } = "open";

public string Title { get; set; } = RandomString();

public UserBuilder? User { get; set; }
Expand Down Expand Up @@ -68,6 +70,7 @@ public override object Build()
mergeable = IsMergeable,
node_id = NodeId,
number = Number,
state = State,
title = Title,
url = $"https://api.github.com/repos/{Repository.Owner.Login}/{Repository.Name}/pulls/{Number}",
user = (User ?? Repository.Owner).Build(),
Expand Down

0 comments on commit 3e552ca

Please sign in to comment.