ReviewGroups can be added as maintainers and can be optionally expanded. This is handy when a ReviewGroup is a project maintainer
18 lines
367 B
Go
18 lines
367 B
Go
package common
|
|
|
|
import (
|
|
"slices"
|
|
)
|
|
|
|
func (group *ReviewGroup) ExpandMaintainers(maintainers []string) []string {
|
|
idx := slices.Index(maintainers, group.Name)
|
|
if idx == -1 {
|
|
return maintainers
|
|
}
|
|
|
|
expandedMaintainers := slices.Replace(maintainers, idx, idx+1, group.Reviewers...)
|
|
slices.Sort(expandedMaintainers)
|
|
return slices.Compact(expandedMaintainers)
|
|
}
|
|
|