-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.go
43 lines (36 loc) · 838 Bytes
/
main.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
package main
import (
"context"
"os"
"gha-file-sync/internal/cfg"
"gha-file-sync/internal/github"
"gha-file-sync/internal/log"
"gha-file-sync/internal/sync"
)
func main() {
ctx := context.Background()
// init of logger
log.Init()
// init of config
log.Infof("Configuration...")
config, err := cfg.InitConfig()
if err != nil {
log.Errorf("initing config: %v", err)
os.Exit(1)
}
config.Print()
// init of github client
ghClient, err := github.NewClient(ctx, config.GithubToken)
if err != nil {
log.Errorf("initing github client: %v", err)
os.Exit(1)
}
// start synchronization
log.Infof("Let's sync")
for _, repoName := range config.RepositoryNames {
if err := sync.Do(ctx, repoName, config, ghClient); err != nil {
log.Errorf("syncing %s: %v", repoName, err)
}
}
log.Infof("Sync finished.")
}