Merge bac46d08b3 into 3811d88913
This commit is contained in:
commit
d2a08fb272
7 changed files with 66 additions and 27 deletions
13
approval.go
13
approval.go
|
|
@ -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
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue