-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.go
37 lines (31 loc) · 1.08 KB
/
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
package main
import (
"context"
"time"
"github.com/alecthomas/kong"
)
var (
// Not yet used
Version = "0.0.0-dev"
)
type CLI struct {
AppID int64 `required:"" env:"GHA_APP_ID" help:"GitHub App ID of application to authenticate as"`
AppKey string `required:"" env:"GHA_APP_KEY" help:"Private key of GitHub App for the App ID"`
Owner string `required:"" env:"GHA_OWNER" help:"GitHub owner of repositories to monitor"`
Repos []string `required:"" help:"Repositories to monitor (must be owned by --owner)"`
Sleep time.Duration `default:"1m" help:"Sleep time (duration string)between polls of GitHub Actions"`
InitialWindow time.Duration `default:"2h" help:"Initial time to look back for runs"`
Backfill bool `default:"false" help:"Backfill completed runs from initial window"`
}
func main() {
var cli CLI
kctx := kong.Parse(&cli)
err := kctx.Run(&cli)
kctx.FatalIfErrorf(err)
}
func (c *CLI) Run() error {
ctx := context.Background()
collector := NewCollector(c)
go collector.Run(ctx)
return RunServer(c)
}