Skip to content

Commit

Permalink
after-the-fact approvals
Browse files Browse the repository at this point in the history
  • Loading branch information
goaaats committed Jan 13, 2025
1 parent d822d83 commit a41fbc2
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions Plogon/GitHubApi.cs
Original file line number Diff line number Diff line change
Expand Up @@ -130,10 +130,16 @@ public async Task<string> GetReviewer(int issueNumber)

var firstApprovingReview = reviews.FirstOrDefault(r => r.State == PullRequestReviewState.Approved &&
PlogonSystemDefine.PacMembers.Contains(r.User.Login));
if (firstApprovingReview == null)
throw new Exception($"No approving reviews on PR {issueNumber}");

return firstApprovingReview.User.Login;
if (firstApprovingReview != null)
return firstApprovingReview.User.Login;

var comments = await this.ghClient.Issue.Comment.GetAllForIssue(repoOwner, repoName, issueNumber);
var firstApprovingComment = comments.FirstOrDefault(c => PlogonSystemDefine.PacMembers.Contains(c.User.Login) &&
c.Body.Equals("bleatbot, approve", StringComparison.OrdinalIgnoreCase));
if (firstApprovingComment != null)
return firstApprovingComment.User.Login;

throw new Exception($"No approving reviews on PR {issueNumber}");
}

/// <summary>
Expand Down

0 comments on commit a41fbc2

Please sign in to comment.