This commit is contained in:
Felipe Lambert 2026-04-14 19:16:03 -07:00 committed by GitHub
commit d2a08fb272
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
7 changed files with 66 additions and 27 deletions

View file

@ -179,7 +179,7 @@ func (a *approvalEnvironment) SetActionOutputs(outputs map[string]string) (bool,
return true, nil
}
func approvalFromComments(comments []*github.IssueComment, approvers []string, minimumApprovals int) (approvalStatus, error) {
func approvalFromComments(comments []*github.IssueComment, approvers []string, minimumApprovals int) (approvalStatus, string, error) {
remainingApprovers := make([]string, len(approvers))
copy(remainingApprovers, approvers)
@ -197,11 +197,11 @@ func approvalFromComments(comments []*github.IssueComment, approvers []string, m
commentBody := comment.GetBody()
isApprovalComment, err := isApproved(commentBody)
if err != nil {
return approvalStatusPending, err
return approvalStatusPending, "", err
}
if isApprovalComment {
if len(remainingApprovers) == len(approvers)-minimumApprovals+1 {
return approvalStatusApproved, nil
return approvalStatusApproved, commentUser, nil
}
remainingApprovers[approverIdx] = remainingApprovers[len(remainingApprovers)-1]
remainingApprovers = remainingApprovers[:len(remainingApprovers)-1]
@ -210,14 +210,14 @@ func approvalFromComments(comments []*github.IssueComment, approvers []string, m
isDenialComment, err := isDenied(commentBody)
if err != nil {
return approvalStatusPending, err
return approvalStatusPending, "", err
}
if isDenialComment {
return approvalStatusDenied, nil
return approvalStatusDenied, commentUser, nil
}
}
return approvalStatusPending, nil
return approvalStatusPending, "", nil
}
func approversIndex(approvers []string, name string) int {
@ -344,4 +344,3 @@ func splitLongString(input string) []string {
}
return result
}