feat: [CODE-2466]: support for codeowners usergroup (#2795)

* feat: [CODE-2466]: support for codeowners usergroup
pull/3576/head
Akhilesh Pandey 2024-10-17 12:45:04 +00:00 committed by Harness
parent 465275b549
commit ac8eb9ff37
1 changed files with 6 additions and 2 deletions

View File

@ -488,8 +488,12 @@ func (s *Service) resolveUserGroupCodeOwner(
Name: usrgrp.Name, Name: usrgrp.Name,
} }
ownersEvaluations := make([]OwnerEvaluation, 0, len(usrgrp.Users)) ownersEvaluations := make([]OwnerEvaluation, 0, len(usrgrp.Users))
for _, uid := range usrgrp.Users { principalInfos, err := s.principalStore.FindManyByUID(ctx, usrgrp.Users)
pullreqReviewer := findReviewerInList("", uid, reviewers) if err != nil {
return nil, fmt.Errorf("error finding user by uids %v for usergroup %s: %w", usrgrp.Users, usrgrp.Identifier, err)
}
for _, principalInfo := range principalInfos {
pullreqReviewer := findReviewerInList(principalInfo.Email, principalInfo.UID, reviewers)
// we don't append all the user of the user group in the owner evaluations and // we don't append all the user of the user group in the owner evaluations and
// append it only if it is reviewed by a user. // append it only if it is reviewed by a user.
if pullreqReviewer != nil { if pullreqReviewer != nil {