@@ -12,7 +12,7 @@ import (
12
12
"strings"
13
13
"sync"
14
14
15
- "sigs.k8s.io /yaml"
15
+ "github.com/ghodss /yaml"
16
16
)
17
17
18
18
const rootRegistryPath = "./registry"
@@ -306,6 +306,11 @@ website:
306
306
}
307
307
}
308
308
309
+ // Avatar URL
310
+ if yml .AvatarUrl != nil {
311
+
312
+ }
313
+
309
314
return errors
310
315
}
311
316
@@ -338,7 +343,12 @@ func remapContributorProfile(
338
343
}
339
344
if employeeGitHubNames != nil {
340
345
remapped .EmployeeGithubUsernames = employeeGitHubNames [:]
341
- slices .Sort (remapped .EmployeeGithubUsernames )
346
+ slices .SortFunc (
347
+ remapped .EmployeeGithubUsernames ,
348
+ func (name1 string , name2 string ) int {
349
+ return strings .Compare (name1 , name2 )
350
+ },
351
+ )
342
352
}
343
353
344
354
return remapped
@@ -447,18 +457,36 @@ func parseContributorFiles(input []directoryReadme) (
447
457
}
448
458
449
459
func backfillAvatarUrls (contributors map [string ]contributorProfile ) error {
460
+ if contributors == nil {
461
+ return errors .New ("provided map is nil" )
462
+ }
463
+
450
464
wg := sync.WaitGroup {}
451
- requestBuffer := make (chan struct {}, 10 )
452
465
errors := []error {}
466
+ errorsMutex := sync.Mutex {}
467
+
468
+ // Todo: Add actual fetching logic once everything else has been verified
469
+ requestAvatarUrl := func (string ) (string , error ) {
470
+ return "" , nil
471
+ }
472
+
473
+ for ghUsername , conCopy := range contributors {
474
+ if conCopy .AvatarUrl != "" {
475
+ continue
476
+ }
453
477
454
- for _ , c := range contributors {
455
478
wg .Add (1 )
456
479
go func () {
457
- requestBuffer <- struct {}{}
458
- // Do request stuff
459
-
460
- <- requestBuffer
461
- wg .Done ()
480
+ defer wg .Done ()
481
+ url , err := requestAvatarUrl (ghUsername )
482
+ if err != nil {
483
+ errorsMutex .Lock ()
484
+ errors = append (errors , err )
485
+ errorsMutex .Unlock ()
486
+ return
487
+ }
488
+ conCopy .AvatarUrl = url
489
+ contributors [ghUsername ] = conCopy
462
490
}()
463
491
}
464
492
@@ -481,12 +509,12 @@ func main() {
481
509
if err != nil {
482
510
log .Panic (err )
483
511
}
512
+
484
513
allReadmeFiles := []directoryReadme {}
485
514
fsErrors := workflowPhaseError {
486
515
Phase : "FileSystem reading" ,
487
516
Errors : []error {},
488
517
}
489
-
490
518
for _ , e := range dirEntries {
491
519
dirPath := path .Join (rootRegistryPath , e .Name ())
492
520
if ! e .IsDir () {
0 commit comments