generator/app: add means for sorted and de-duped OWNERS_ALIASES

- Add LeadershipGroup#Owners() which returns a sorted and de-duped
list of owners ([]Person) for this LeadershipGroup by combining
Chairs and TechnicalLeads
- The function is used in generator/aliases.tmpl
- Update OWNERS_ALIASES with the new results
This commit is contained in:
Lubomir I. Ivanov 2020-01-23 04:44:02 +02:00
parent ba5dd2e8c2
commit 0d52e7b449
3 changed files with 35 additions and 16 deletions

View File

@ -2,7 +2,6 @@ aliases:
sig-api-machinery-leads: sig-api-machinery-leads:
- deads2k - deads2k
- fedebongio - fedebongio
- deads2k
- lavalamp - lavalamp
sig-apps-leads: sig-apps-leads:
- janetkuo - janetkuo
@ -14,31 +13,29 @@ aliases:
- dims - dims
- johnbelamaric - johnbelamaric
sig-auth-leads: sig-auth-leads:
- enj
- mikedanese
- tallclair
- deads2k - deads2k
- enj
- liggitt - liggitt
- mikedanese - mikedanese
- tallclair
sig-autoscaling-leads: sig-autoscaling-leads:
- mwielgus - mwielgus
sig-cli-leads: sig-cli-leads:
- seans3
- soltysh
- pwittrock - pwittrock
- seans3
- soltysh - soltysh
sig-cloud-provider-leads: sig-cloud-provider-leads:
- andrewsykim - andrewsykim
- cheftako - cheftako
sig-cluster-lifecycle-leads: sig-cluster-lifecycle-leads:
- fabriziopandini
- justinsb - justinsb
- neolit123 - neolit123
- timothysc - timothysc
- fabriziopandini
sig-contributor-experience-leads: sig-contributor-experience-leads:
- Phillels - Phillels
- mrbobbytables
- cblecker - cblecker
- mrbobbytables
- nikhita - nikhita
sig-docs-leads: sig-docs-leads:
- Bradamant3 - Bradamant3
@ -94,9 +91,9 @@ aliases:
- vllry - vllry
sig-windows-leads: sig-windows-leads:
- PatrickLang - PatrickLang
- michmike
- benmoss - benmoss
- ddebroy - ddebroy
- michmike
wg-apply-leads: wg-apply-leads:
- lavalamp - lavalamp
wg-component-standard-leads: wg-component-standard-leads:
@ -146,8 +143,10 @@ aliases:
- foxish - foxish
- liyinan926 - liyinan926
ug-vmware-users-leads: ug-vmware-users-leads:
- brysonshepherd
- cantbewong - cantbewong
- mylesagray - mylesagray
- phenixblue
committee-code-of-conduct: committee-code-of-conduct:
- AevaOnline - AevaOnline
- Bradamant3 - Bradamant3

View File

@ -1,28 +1,25 @@
aliases: aliases:
{{- range .Sigs}} {{- range .Sigs}}
{{.Dir}}-leads: {{.Dir}}-leads:
{{- range .Leadership.Chairs}} {{- range .Leadership.Owners}}
- {{.GitHub}}
{{- end}}
{{- range .Leadership.TechnicalLeads}}
- {{.GitHub}} - {{.GitHub}}
{{- end}} {{- end}}
{{- end}} {{- end}}
{{- range .WorkingGroups}} {{- range .WorkingGroups}}
{{.Dir}}-leads: {{.Dir}}-leads:
{{- range .Leadership.Chairs}} {{- range .Leadership.Owners}}
- {{.GitHub}} - {{.GitHub}}
{{- end}} {{- end}}
{{- end}} {{- end}}
{{- range .UserGroups}} {{- range .UserGroups}}
{{.Dir}}-leads: {{.Dir}}-leads:
{{- range .Leadership.Chairs}} {{- range .Leadership.Owners}}
- {{.GitHub}} - {{.GitHub}}
{{- end}} {{- end}}
{{- end}} {{- end}}
{{- range .Committees}} {{- range .Committees}}
{{.Dir}}: {{.Dir}}:
{{- range .Leadership.Chairs}} {{- range .Leadership.Owners}}
- {{.GitHub}} - {{.GitHub}}
{{- end}} {{- end}}
{{- end}} {{- end}}

View File

@ -122,6 +122,29 @@ func (g *LeadershipGroup) PrefixToPersonMap() map[string][]Person {
} }
} }
// Owners returns a sorted and de-duped list of owners for a LeadershipGroup
func (g *LeadershipGroup) Owners() []Person {
o := append(g.Chairs, g.TechnicalLeads...)
// Sort
sort.Slice(o, func(i, j int) bool {
return o[i].GitHub < o[j].GitHub
})
// De-dupe
seen := make(map[string]struct{}, len(o))
i := 0
for _, p := range o {
if _, ok := seen[p.GitHub]; ok {
continue
}
seen[p.GitHub] = struct{}{}
o[i] = p
i++
}
return o[:i]
}
// Group represents either a Special Interest Group (SIG) or a Working Group (WG) // Group represents either a Special Interest Group (SIG) or a Working Group (WG)
type Group struct { type Group struct {
Dir string Dir string