├── .gitignore ├── pkg ├── domain │ ├── types │ │ ├── const.go │ │ ├── errors.go │ │ └── context.go │ └── model │ │ ├── config.go │ │ └── rego.go ├── controller │ ├── server │ │ ├── healthcheck.go │ │ ├── healthcheck_test.go │ │ ├── webhook.go │ │ ├── server.go │ │ └── webhook_test.go │ └── cmd │ │ ├── option │ │ ├── log_output.go │ │ ├── log_level.go │ │ └── log_format.go │ │ ├── serve.go │ │ ├── emit.go │ │ ├── cli_test.go │ │ └── cli.go ├── usecase │ ├── usecase.go │ └── github_event.go ├── infra │ ├── clients.go │ └── notify │ │ ├── client.go │ │ └── client_test.go └── utils │ └── logger.go ├── main.go ├── Dockerfile ├── examples ├── policy │ ├── check_suite_failed.rego │ ├── added_label.rego │ ├── comment_with_keyword.rego │ ├── new_deploy_key.rego │ ├── issue_opened.rego │ └── repository.rego └── data │ ├── issue.json │ └── check_suite.json ├── .github └── workflows │ ├── lint.yml │ ├── test.yml │ ├── trivy.yml │ ├── gosec.yml │ ├── binary.yml │ └── image.yml ├── go.mod ├── README.md ├── LICENSE └── go.sum /.gitignore: -------------------------------------------------------------------------------- 1 | .env 2 | .vscode 3 | 4 | *.json 5 | 6 | -------------------------------------------------------------------------------- /pkg/domain/types/const.go: -------------------------------------------------------------------------------- 1 | package types 2 | 3 | const ( 4 | EnvSlackWebhook = "GHNOTIFY_SLACK_WEBHOOK" 5 | ) 6 | -------------------------------------------------------------------------------- /pkg/domain/model/config.go: -------------------------------------------------------------------------------- 1 | package model 2 | 3 | type Config struct { 4 | WebhookSecret string `masq:"secret"` 5 | } 6 | -------------------------------------------------------------------------------- /main.go: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | import ( 4 | "os" 5 | 6 | "github.com/m-mizutani/ghnotify/pkg/controller/cmd" 7 | ) 8 | 9 | func main() { 10 | if err := cmd.Run(os.Args); err != nil { 11 | os.Exit(1) 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /pkg/domain/types/errors.go: -------------------------------------------------------------------------------- 1 | package types 2 | 3 | import "github.com/m-mizutani/goerr" 4 | 5 | var ( 6 | ErrInvalidWebhookRequest = goerr.New("invalid webhook request") 7 | 8 | ErrInvalidConfig = goerr.New("invalid config") 9 | ) 10 | -------------------------------------------------------------------------------- /Dockerfile: -------------------------------------------------------------------------------- 1 | FROM golang:1.20 AS build-go 2 | COPY . /src 3 | WORKDIR /src 4 | RUN CGO_ENABLED=0 go build -o ghnotify . 5 | 6 | FROM gcr.io/distroless/base 7 | COPY --from=build-go /src/ghnotify /ghnotify 8 | WORKDIR / 9 | ENTRYPOINT ["/ghnotify"] 10 | -------------------------------------------------------------------------------- /examples/policy/check_suite_failed.rego: -------------------------------------------------------------------------------- 1 | package github.notify 2 | 3 | notify[msg] { 4 | input.name == "check_suite" 5 | input.event.check_suite.conclusion == "failure" 6 | 7 | msg := { 8 | "text": "Check suite failed", 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /.github/workflows/lint.yml: -------------------------------------------------------------------------------- 1 | name: Lint 2 | on: 3 | push: 4 | 5 | jobs: 6 | golangci: 7 | name: lint 8 | runs-on: ubuntu-latest 9 | steps: 10 | - uses: actions/checkout@v2 11 | - name: golangci-lint 12 | uses: golangci/golangci-lint-action@v2 13 | -------------------------------------------------------------------------------- /examples/policy/added_label.rego: -------------------------------------------------------------------------------- 1 | package github.notify 2 | 3 | notify[msg] { 4 | input.name == "pull_request" 5 | input.event.action == "labeled" 6 | input.event.label.name == "breaking-change" 7 | 8 | msg := { 9 | "channel": "#alert", 10 | "text": "A new breaking change PR", 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /examples/policy/comment_with_keyword.rego: -------------------------------------------------------------------------------- 1 | package github.notify 2 | 3 | notify[msg] { 4 | input.name == "issue_comment" 5 | contains(input.event.comment.body, "mizutani") 6 | msg := { 7 | "channel": "#notify-mizutani", 8 | "text": "Hello, mizutani", 9 | "body": input.event.comment.body, 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /.github/workflows/test.yml: -------------------------------------------------------------------------------- 1 | name: Test 2 | 3 | on: [push] 4 | 5 | jobs: 6 | testing: 7 | runs-on: ubuntu-latest 8 | 9 | steps: 10 | - name: Checkout upstream repo 11 | uses: actions/checkout@v2 12 | with: 13 | ref: ${{ github.head_ref }} 14 | - uses: actions/setup-go@v2 15 | with: 16 | go-version: "1.20" 17 | - run: go test ./... 18 | - run: go vet ./... 19 | -------------------------------------------------------------------------------- /pkg/controller/server/healthcheck.go: -------------------------------------------------------------------------------- 1 | package server 2 | 3 | import ( 4 | "net/http" 5 | 6 | "github.com/m-mizutani/ghnotify/pkg/utils" 7 | ) 8 | 9 | func handleHealthCheckRequest() http.HandlerFunc { 10 | return func(w http.ResponseWriter, r *http.Request) { 11 | w.WriteHeader(http.StatusOK) 12 | if _, err := w.Write([]byte("OK")); err != nil { 13 | utils.Logger.Error("fail to write response", utils.ErrLog(err)) 14 | } 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /pkg/controller/server/healthcheck_test.go: -------------------------------------------------------------------------------- 1 | package server_test 2 | 3 | import ( 4 | "net/http/httptest" 5 | "testing" 6 | 7 | "github.com/m-mizutani/ghnotify/pkg/controller/server" 8 | "github.com/m-mizutani/ghnotify/pkg/usecase" 9 | "github.com/stretchr/testify/assert" 10 | ) 11 | 12 | func TestHealthCheck(t *testing.T) { 13 | srv := server.New(&usecase.Usecase{}) 14 | 15 | w := httptest.NewRecorder() 16 | r := httptest.NewRequest("GET", "/health", nil) 17 | srv.ServeHTTP(w, r) 18 | 19 | assert.Equal(t, 200, w.Code) 20 | } 21 | -------------------------------------------------------------------------------- /examples/policy/new_deploy_key.rego: -------------------------------------------------------------------------------- 1 | package github.notify 2 | 3 | notify[msg] { 4 | input.name == "deploy_key" 5 | input.event.action == "created" 6 | msg := { 7 | "channel": "#alert", 8 | "text": "A new deploy key created", 9 | "fields": [ 10 | { 11 | "name": "title", 12 | "value": input.event.key.title, 13 | }, 14 | { 15 | "name": "read_only", 16 | "value": input.event.key.read_only, 17 | }, 18 | ], 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /pkg/domain/model/rego.go: -------------------------------------------------------------------------------- 1 | package model 2 | 3 | type RegoInput struct { 4 | Name string `json:"name"` 5 | Event interface{} `json:"event"` 6 | } 7 | 8 | type RegoResult struct { 9 | Notify []*Notify `json:"notify"` 10 | } 11 | 12 | type Notify struct { 13 | Channel string `json:"channel"` 14 | Text string `json:"text"` 15 | Body string `json:"body"` 16 | Color string `json:"color"` 17 | Fields []*NotifyField `json:"fields"` 18 | } 19 | 20 | type NotifyField struct { 21 | Name string `json:"name"` 22 | Value any `json:"value"` 23 | URL string `json:"url"` 24 | } 25 | -------------------------------------------------------------------------------- /examples/policy/issue_opened.rego: -------------------------------------------------------------------------------- 1 | package github.notify 2 | 3 | notify[msg] { 4 | input.name == "issues" 5 | input.event.action == "opened" 6 | input.event.repository.full_name == "mizutani-sandbox/test-repo" 7 | labels = { name | name := input.event.issue.labels[_].name } 8 | msg := { 9 | "channel": "#alert", 10 | "color": "#123456", 11 | "text": "issue opened", 12 | "body": input.event.issue.body, 13 | "fields": [ 14 | { 15 | "name": "labels", 16 | "value": concat(", ", labels), 17 | }, 18 | ], 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /examples/policy/repository.rego: -------------------------------------------------------------------------------- 1 | package github.notify 2 | 3 | notify[msg] { 4 | input.name == "repository" 5 | input.event.action == "created" 6 | 7 | msg := { 8 | "channel": "#alert", 9 | "text": "repository created", 10 | } 11 | } 12 | 13 | notify[msg] { 14 | input.name == "repository" 15 | input.event.action == "deleted" 16 | 17 | msg := { 18 | "channel": "#alert", 19 | "text": "repository created", 20 | } 21 | } 22 | 23 | notify[msg] { 24 | input.name == "repository" 25 | input.event.action == "publicized" 26 | 27 | msg := { 28 | "channel": "#alert", 29 | "text": "repository publicized", 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /.github/workflows/trivy.yml: -------------------------------------------------------------------------------- 1 | name: Vuln scan 2 | 3 | on: [push] 4 | 5 | jobs: 6 | scan: 7 | runs-on: ubuntu-latest 8 | 9 | steps: 10 | - name: Checkout upstream repo 11 | uses: actions/checkout@v2 12 | with: 13 | ref: ${{ github.head_ref }} 14 | - name: Run Trivy vulnerability scanner in repo mode 15 | uses: aquasecurity/trivy-action@master 16 | with: 17 | scan-type: "fs" 18 | ignore-unfixed: true 19 | format: "template" 20 | template: "@/contrib/sarif.tpl" 21 | output: "trivy-results.sarif" 22 | skip-dirs: pkg/infra/trivy/testdata 23 | 24 | - name: Upload Trivy scan results to GitHub Security tab 25 | uses: github/codeql-action/upload-sarif@v1 26 | with: 27 | sarif_file: "trivy-results.sarif" 28 | -------------------------------------------------------------------------------- /pkg/usecase/usecase.go: -------------------------------------------------------------------------------- 1 | package usecase 2 | 3 | import ( 4 | "github.com/google/go-github/v43/github" 5 | "github.com/m-mizutani/ghnotify/pkg/domain/model" 6 | "github.com/m-mizutani/ghnotify/pkg/domain/types" 7 | "github.com/m-mizutani/ghnotify/pkg/infra" 8 | ) 9 | 10 | type Usecase struct { 11 | config *model.Config 12 | clients *infra.Clients 13 | } 14 | 15 | func New(cfg *model.Config, clients *infra.Clients) *Usecase { 16 | return &Usecase{ 17 | config: cfg, 18 | clients: clients, 19 | } 20 | } 21 | 22 | func (x *Usecase) ValidateWebhook(signature string, body []byte) error { 23 | if x.config.WebhookSecret == "" { 24 | return nil 25 | } 26 | 27 | if err := github.ValidateSignature(signature, body, []byte(x.config.WebhookSecret)); err != nil { 28 | return types.ErrInvalidWebhookRequest.Wrap(err) 29 | } 30 | 31 | return nil 32 | } 33 | -------------------------------------------------------------------------------- /pkg/controller/server/webhook.go: -------------------------------------------------------------------------------- 1 | package server 2 | 3 | import ( 4 | "io" 5 | "net/http" 6 | 7 | "github.com/m-mizutani/ghnotify/pkg/domain/types" 8 | "github.com/m-mizutani/ghnotify/pkg/usecase" 9 | "github.com/m-mizutani/goerr" 10 | ) 11 | 12 | func handleGitHubWebhook(uc *usecase.Usecase, r *http.Request) error { 13 | ctx := toCtx(r) 14 | 15 | eventType := r.Header.Get("X-GitHub-Event") 16 | if eventType == "" { 17 | return goerr.Wrap(types.ErrInvalidWebhookRequest) 18 | } 19 | eventBody, err := io.ReadAll(r.Body) 20 | if err != nil { 21 | return goerr.Wrap(err) 22 | } 23 | 24 | signature := r.Header.Get("X-Hub-Signature-256") 25 | if err := uc.ValidateWebhook(signature, eventBody); err != nil { 26 | return err 27 | } 28 | 29 | if err := uc.HandleGitHubEvent(ctx, eventType, eventBody); err != nil { 30 | return err 31 | } 32 | 33 | return nil 34 | } 35 | -------------------------------------------------------------------------------- /pkg/domain/types/context.go: -------------------------------------------------------------------------------- 1 | package types 2 | 3 | import ( 4 | "context" 5 | 6 | "github.com/m-mizutani/ghnotify/pkg/utils" 7 | "golang.org/x/exp/slog" 8 | ) 9 | 10 | type Context struct { 11 | context.Context 12 | logger *slog.Logger 13 | } 14 | 15 | type ContextOption func(c *Context) 16 | 17 | func NewContext(options ...ContextOption) *Context { 18 | ctx := &Context{ 19 | Context: context.Background(), 20 | logger: utils.Logger, 21 | } 22 | 23 | for _, opt := range options { 24 | opt(ctx) 25 | } 26 | return ctx 27 | } 28 | 29 | func WithCtx(ctx context.Context) ContextOption { 30 | return func(c *Context) { 31 | c.Context = ctx 32 | } 33 | } 34 | 35 | func WithLogger(logger *slog.Logger) ContextOption { 36 | return func(c *Context) { 37 | c.logger = logger 38 | } 39 | } 40 | 41 | func (x *Context) Log() *slog.Logger { 42 | return x.logger 43 | } 44 | -------------------------------------------------------------------------------- /.github/workflows/gosec.yml: -------------------------------------------------------------------------------- 1 | name: "Gosec" 2 | 3 | # Run workflow each time code is pushed to your repository and on a schedule. 4 | # The scheduled workflow runs every at 00:00 on Sunday UTC time. 5 | on: 6 | push: 7 | 8 | jobs: 9 | tests: 10 | runs-on: ubuntu-latest 11 | env: 12 | GO111MODULE: on 13 | steps: 14 | - name: Checkout Source 15 | uses: actions/checkout@v2 16 | - name: Run Gosec Security Scanner 17 | uses: securego/gosec@master 18 | with: 19 | # we let the report trigger content trigger a failure using the GitHub Security features. 20 | args: "-no-fail -fmt sarif -out results.sarif ./..." 21 | - name: Upload SARIF file 22 | uses: github/codeql-action/upload-sarif@v1 23 | with: 24 | # Path to SARIF file relative to the root of the repository 25 | sarif_file: results.sarif 26 | -------------------------------------------------------------------------------- /.github/workflows/binary.yml: -------------------------------------------------------------------------------- 1 | on: 2 | release: 3 | types: [created] 4 | 5 | jobs: 6 | releases-matrix: 7 | name: Release Go Binary 8 | runs-on: ubuntu-latest 9 | strategy: 10 | matrix: 11 | # build and publish in parallel: linux/386, linux/amd64, linux/arm64, windows/386, windows/amd64, darwin/amd64, darwin/arm64 12 | goos: [linux, windows, darwin] 13 | goarch: ["386", amd64, arm64] 14 | exclude: 15 | - goarch: "386" 16 | goos: darwin 17 | - goarch: arm64 18 | goos: windows 19 | steps: 20 | - uses: actions/checkout@v2 21 | - uses: wangyoucao577/go-release-action@v1.22 22 | with: 23 | github_token: ${{ secrets.GITHUB_TOKEN }} 24 | goos: ${{ matrix.goos }} 25 | goarch: ${{ matrix.goarch }} 26 | binary_name: "ghnotify" 27 | extra_files: LICENSE README.md 28 | -------------------------------------------------------------------------------- /pkg/controller/cmd/option/log_output.go: -------------------------------------------------------------------------------- 1 | package option 2 | 3 | import ( 4 | "io" 5 | "os" 6 | "path/filepath" 7 | "strings" 8 | 9 | "github.com/m-mizutani/goerr" 10 | ) 11 | 12 | type LogOutput struct { 13 | v string 14 | w io.Writer 15 | } 16 | 17 | func NewLogOutput(w io.Writer) *LogOutput { 18 | return &LogOutput{w: w, v: "default"} 19 | } 20 | 21 | func (x *LogOutput) Set(value string) error { 22 | var w io.Writer 23 | switch strings.ToLower(value) { 24 | case "-", "stdout": 25 | w = os.Stdout 26 | case "stderr": 27 | w = os.Stderr 28 | default: 29 | f, err := os.Create(filepath.Clean(value)) 30 | if err != nil { 31 | return goerr.Wrap(err, "Failed to open log file").With("path", value) 32 | } 33 | w = f 34 | } 35 | 36 | x.v = value 37 | x.w = w 38 | 39 | return nil 40 | } 41 | 42 | func (x *LogOutput) String() string { 43 | return x.v 44 | } 45 | 46 | func (x *LogOutput) Writer() io.Writer { 47 | if x.w == nil { 48 | return os.Stdout 49 | } 50 | return x.w 51 | } 52 | -------------------------------------------------------------------------------- /pkg/controller/cmd/option/log_level.go: -------------------------------------------------------------------------------- 1 | package option 2 | 3 | import ( 4 | "golang.org/x/exp/slog" 5 | 6 | "github.com/m-mizutani/alertchain/pkg/domain/types" 7 | "github.com/m-mizutani/goerr" 8 | ) 9 | 10 | type LogLevel struct { 11 | level slog.Level 12 | } 13 | 14 | func NewLogLevel(level slog.Level) *LogLevel { 15 | return &LogLevel{level: level} 16 | } 17 | 18 | func (x *LogLevel) Set(value string) error { 19 | levelMap := map[string]slog.Level{ 20 | "debug": slog.LevelDebug, 21 | "info": slog.LevelInfo, 22 | "warn": slog.LevelWarn, 23 | "error": slog.LevelError, 24 | } 25 | 26 | level, ok := levelMap[value] 27 | if !ok { 28 | return goerr.Wrap(types.ErrInvalidOption, "Invalid log level").With("level", value) 29 | } 30 | 31 | x.level = level 32 | return nil 33 | } 34 | 35 | func (x *LogLevel) String() string { 36 | return x.Level().String() 37 | } 38 | 39 | func (x *LogLevel) Level() slog.Level { 40 | if x.level == 0 { 41 | return slog.LevelInfo 42 | } 43 | 44 | return x.level 45 | } 46 | -------------------------------------------------------------------------------- /pkg/infra/clients.go: -------------------------------------------------------------------------------- 1 | package infra 2 | 3 | import ( 4 | "github.com/m-mizutani/ghnotify/pkg/infra/notify" 5 | "github.com/m-mizutani/opac" 6 | ) 7 | 8 | type Clients struct { 9 | slackClient notify.SlackClient 10 | opac opac.Client 11 | } 12 | 13 | func (x *Clients) Slack() notify.SlackClient { 14 | if x.slackClient == nil { 15 | panic("slackClient is not configured") 16 | } 17 | return x.slackClient 18 | } 19 | 20 | func (x *Clients) OPAC() opac.Client { 21 | if x.opac == nil { 22 | panic("opac is not configured") 23 | } 24 | return x.opac 25 | } 26 | 27 | type Option func(c *Clients) 28 | 29 | func New(options ...Option) *Clients { 30 | clients := &Clients{} 31 | for _, opt := range options { 32 | opt(clients) 33 | } 34 | return clients 35 | } 36 | 37 | func WithSlack(client notify.SlackClient) Option { 38 | return func(c *Clients) { 39 | c.slackClient = client 40 | } 41 | } 42 | 43 | func WithOPAC(client opac.Client) Option { 44 | return func(c *Clients) { 45 | c.opac = client 46 | } 47 | } 48 | -------------------------------------------------------------------------------- /pkg/controller/cmd/serve.go: -------------------------------------------------------------------------------- 1 | package cmd 2 | 3 | import ( 4 | "github.com/m-mizutani/ghnotify/pkg/controller/server" 5 | "github.com/urfave/cli/v2" 6 | ) 7 | 8 | func cmdServe(cfg *globalConfig) *cli.Command { 9 | var config struct { 10 | Addr string 11 | } 12 | return &cli.Command{ 13 | Name: "serve", 14 | Usage: "Run http server", 15 | Flags: []cli.Flag{ 16 | &cli.StringFlag{ 17 | Name: "addr", 18 | Usage: "HTTP server address", 19 | EnvVars: []string{"GHNOTIFY_ADDR"}, 20 | Value: "0.0.0.0:4080", 21 | Destination: &config.Addr, 22 | }, 23 | &cli.StringFlag{ 24 | Name: "webhook-secret", 25 | Usage: "GitHub Webhook secret", 26 | EnvVars: []string{"GHNOTIFY_WEBHOOK_SECRET"}, 27 | Destination: &cfg.GitHubWebhookSecret, 28 | }, 29 | }, 30 | Action: func(ctx *cli.Context) error { 31 | uc, err := cfg.newUsecase() 32 | if err != nil { 33 | return err 34 | } 35 | 36 | srv := server.New(uc) 37 | if err := srv.Listen(config.Addr); err != nil { 38 | return err 39 | } 40 | return nil 41 | }, 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /pkg/controller/cmd/option/log_format.go: -------------------------------------------------------------------------------- 1 | package option 2 | 3 | import ( 4 | "strings" 5 | 6 | "github.com/m-mizutani/alertchain/pkg/domain/types" 7 | "github.com/m-mizutani/goerr" 8 | ) 9 | 10 | type LogFormatType int 11 | 12 | func (x LogFormatType) String() string { 13 | switch x { 14 | case LogFormatConsole: 15 | return "console" 16 | case LogFormatJSON: 17 | return "json" 18 | default: 19 | return "unknown" 20 | } 21 | } 22 | 23 | const ( 24 | LogFormatConsole LogFormatType = iota + 1 25 | LogFormatJSON 26 | ) 27 | 28 | type LogFormat struct { 29 | fmtType LogFormatType 30 | } 31 | 32 | func NewLogFormat(fmtType LogFormatType) *LogFormat { 33 | return &LogFormat{fmtType: fmtType} 34 | } 35 | 36 | func (x *LogFormat) Set(value string) error { 37 | formatMap := map[string]LogFormatType{ 38 | "console": LogFormatConsole, 39 | "c": LogFormatConsole, 40 | "json": LogFormatJSON, 41 | "j": LogFormatJSON, 42 | } 43 | 44 | fmtType, ok := formatMap[strings.ToLower(value)] 45 | if !ok { 46 | return goerr.Wrap(types.ErrInvalidOption, "Invalid log format").With("format", value) 47 | } 48 | 49 | x.fmtType = fmtType 50 | return nil 51 | } 52 | 53 | func (x *LogFormat) String() string { 54 | return x.Format().String() 55 | } 56 | 57 | func (x *LogFormat) Format() LogFormatType { 58 | if x.fmtType == 0 { 59 | return LogFormatConsole 60 | } 61 | return x.fmtType 62 | } 63 | -------------------------------------------------------------------------------- /pkg/infra/notify/client.go: -------------------------------------------------------------------------------- 1 | package notify 2 | 3 | import ( 4 | "encoding/json" 5 | 6 | "github.com/m-mizutani/ghnotify/pkg/domain/types" 7 | "github.com/m-mizutani/goerr" 8 | "github.com/slack-go/slack" 9 | ) 10 | 11 | type SlackClient interface { 12 | Post(ctx *types.Context, msg *slack.WebhookMessage) error 13 | } 14 | 15 | type webhookClient struct { 16 | url string 17 | } 18 | 19 | func NewSlackWebhook(url string) *webhookClient { 20 | return &webhookClient{ 21 | url: url, 22 | } 23 | } 24 | 25 | func (x *webhookClient) Post(ctx *types.Context, msg *slack.WebhookMessage) error { 26 | if err := slack.PostWebhookContext(ctx, x.url, msg); err != nil { 27 | raw, _ := json.Marshal(msg) 28 | return goerr.Wrap(err).With("body", string(raw)) 29 | } 30 | return nil 31 | } 32 | 33 | type webhookMock struct { 34 | PostMock func(ctx *types.Context, msg *slack.WebhookMessage) error 35 | } 36 | 37 | func NewSlackWebhookMock() *webhookMock { 38 | return &webhookMock{} 39 | } 40 | 41 | func (x *webhookMock) Post(ctx *types.Context, msg *slack.WebhookMessage) error { 42 | return x.PostMock(ctx, msg) 43 | } 44 | 45 | type apiClient struct { 46 | api *slack.Client 47 | } 48 | 49 | func NewSlackAPI(token string) *apiClient { 50 | return &apiClient{ 51 | api: slack.New(token), 52 | } 53 | } 54 | 55 | func (x *apiClient) Post(ctx *types.Context, msg *slack.WebhookMessage) error { 56 | if _, _, _, err := x.api.SendMessageContext(ctx, msg.Channel, 57 | slack.MsgOptionText(msg.Text, false), 58 | slack.MsgOptionAttachments(msg.Attachments...), 59 | ); err != nil { 60 | raw, _ := json.Marshal(msg) 61 | return goerr.Wrap(err).With("body", string(raw)) 62 | } 63 | 64 | return nil 65 | } 66 | -------------------------------------------------------------------------------- /pkg/controller/cmd/emit.go: -------------------------------------------------------------------------------- 1 | package cmd 2 | 3 | import ( 4 | "io" 5 | "os" 6 | "path/filepath" 7 | 8 | "github.com/m-mizutani/ghnotify/pkg/domain/types" 9 | "github.com/m-mizutani/goerr" 10 | "github.com/urfave/cli/v2" 11 | ) 12 | 13 | func cmdEmit(cfg *globalConfig) *cli.Command { 14 | var ( 15 | eventFile string 16 | eventType string 17 | ) 18 | return &cli.Command{ 19 | Name: "emit", 20 | Usage: "Read a local file and handle as event data", 21 | Flags: []cli.Flag{ 22 | &cli.StringFlag{ 23 | Name: "event-file", 24 | Usage: "Event data JSON file, `-` means stdin", 25 | Aliases: []string{"f"}, 26 | EnvVars: []string{"GHNOTIFY_EVENT_FILE"}, 27 | Destination: &eventFile, 28 | Required: true, 29 | }, 30 | &cli.StringFlag{ 31 | Name: "event-type", 32 | Usage: "GitHub event type", 33 | Aliases: []string{"t"}, 34 | EnvVars: []string{"GHNOTIFY_EVENT_TYPE"}, 35 | Destination: &eventType, 36 | Required: true, 37 | }, 38 | }, 39 | Action: func(c *cli.Context) error { 40 | uc, err := cfg.newUsecase() 41 | if err != nil { 42 | return err 43 | } 44 | 45 | var data []byte 46 | if eventFile != "-" { 47 | raw, err := os.ReadFile(filepath.Clean(eventFile)) 48 | if err != nil { 49 | return goerr.Wrap(err) 50 | } 51 | data = raw 52 | } else { 53 | raw, err := io.ReadAll(os.Stdin) 54 | if err != nil { 55 | return goerr.Wrap(err) 56 | } 57 | data = raw 58 | } 59 | 60 | ctx := types.NewContext(types.WithCtx(c.Context)) 61 | if err := uc.HandleGitHubEvent(ctx, eventType, data); err != nil { 62 | return err 63 | } 64 | return nil 65 | }, 66 | } 67 | } 68 | -------------------------------------------------------------------------------- /pkg/infra/notify/client_test.go: -------------------------------------------------------------------------------- 1 | package notify_test 2 | 3 | import ( 4 | "encoding/json" 5 | "os" 6 | "testing" 7 | 8 | "github.com/m-mizutani/ghnotify/pkg/domain/types" 9 | "github.com/m-mizutani/ghnotify/pkg/infra/notify" 10 | "github.com/slack-go/slack" 11 | "github.com/stretchr/testify/require" 12 | ) 13 | 14 | func TestSlackClient(t *testing.T) { 15 | url, ok := os.LookupEnv(types.EnvSlackWebhook) 16 | if !ok { 17 | t.Skip(types.EnvSlackWebhook + " is not set") 18 | } 19 | client := notify.NewSlackWebhook(url) 20 | 21 | msg := &slack.WebhookMessage{ 22 | Text: "Hello, mizutani", 23 | Attachments: []slack.Attachment{ 24 | { 25 | Color: "#2EB67D", 26 | 27 | Blocks: slack.Blocks{ 28 | BlockSet: []slack.Block{ 29 | slack.SectionBlock{ 30 | Type: slack.MBTSection, 31 | Fields: []*slack.TextBlockObject{ 32 | slack.NewTextBlockObject(slack.MarkdownType, "*Repo*: ", false, false), 33 | slack.NewTextBlockObject(slack.MarkdownType, "*Issue*: ", false, false), 34 | slack.NewTextBlockObject(slack.MarkdownType, "*Author*: ", false, false), 35 | }, 36 | }, 37 | slack.NewDividerBlock(), 38 | slack.SectionBlock{ 39 | Type: slack.MBTSection, 40 | Text: &slack.TextBlockObject{ 41 | Type: slack.MarkdownType, 42 | Text: "This implementation is slightly complicated. What do you think, mizutani?", 43 | }, 44 | }, 45 | }, 46 | }, 47 | }, 48 | }, 49 | } 50 | raw, err := json.Marshal(msg) 51 | require.NoError(t, err) 52 | t.Log(string(raw)) 53 | require.NoError(t, client.Post(types.NewContext(), msg)) 54 | } 55 | -------------------------------------------------------------------------------- /pkg/controller/cmd/cli_test.go: -------------------------------------------------------------------------------- 1 | package cmd_test 2 | 3 | import ( 4 | "fmt" 5 | "os" 6 | "testing" 7 | "time" 8 | 9 | "github.com/m-mizutani/ghnotify/pkg/controller/cmd" 10 | "github.com/stretchr/testify/assert" 11 | ) 12 | 13 | func TestRun(t *testing.T) { 14 | type EnvTest struct { 15 | port string 16 | value string 17 | } 18 | 19 | testCases := map[string]map[string]EnvTest{ 20 | "GHNOTIFY_LOG_LEVEL": { 21 | "debug": EnvTest{"4081", "debug"}, 22 | "info": EnvTest{"4082", "info"}, 23 | "warn": EnvTest{"4083", "warn"}, 24 | "error": EnvTest{"4084", "error"}, 25 | }, 26 | "GHNOTIFY_LOG_FORMAT": { 27 | "text": EnvTest{"4085", "console"}, 28 | "json": EnvTest{"4086", "json"}, 29 | }, 30 | "GHNOTIFY_LOG_OUTPUT": { 31 | "stdout": EnvTest{"4087", "stdout"}, 32 | "stderr": EnvTest{"4088", "stderr"}, 33 | }, 34 | } 35 | 36 | for envKey, variations := range testCases { 37 | for variationName, variation := range variations { 38 | testName := fmt.Sprintf("%s as %s", envKey, variationName) 39 | t.Run(testName, func(t *testing.T) { 40 | os.Setenv(envKey, variation.value) 41 | defer os.Unsetenv(envKey) 42 | 43 | errCh := make(chan error) 44 | 45 | go func() { 46 | argv := []string{ 47 | "ghnotify", 48 | "--slack-api-token", 49 | "dummy", 50 | "--remote-url", 51 | "localhost:1234", 52 | "serve", 53 | "--addr", 54 | "0.0.0.0:" + variation.port, 55 | } 56 | err := cmd.Run(argv) 57 | errCh <- err 58 | }() 59 | 60 | select { 61 | case err := <-errCh: 62 | assert.NoError(t, err) 63 | case <-time.After(time.Duration(0.01 * float64(time.Second))): 64 | t.Log("cmd.Run exited without error") 65 | } 66 | }) 67 | } 68 | } 69 | } 70 | -------------------------------------------------------------------------------- /pkg/utils/logger.go: -------------------------------------------------------------------------------- 1 | package utils 2 | 3 | import ( 4 | "fmt" 5 | "io" 6 | "os" 7 | "sync" 8 | 9 | "github.com/m-mizutani/clog" 10 | "github.com/m-mizutani/goerr" 11 | "github.com/m-mizutani/masq" 12 | "golang.org/x/exp/slog" 13 | 14 | "github.com/m-mizutani/ghnotify/pkg/controller/cmd/option" 15 | ) 16 | 17 | var ( 18 | Logger = slog.New(clog.New( 19 | clog.WithWriter(os.Stdout), 20 | clog.WithLevel(slog.LevelInfo)), 21 | ) 22 | mutex = &sync.Mutex{} 23 | currentLogFormat = option.LogFormatConsole 24 | ) 25 | 26 | func RenewLogger(w io.Writer, level option.LogLevel, format option.LogFormat) { 27 | filter := masq.New(masq.WithTag("secret")) 28 | 29 | var newLogger *slog.Logger 30 | switch format.Format() { 31 | case option.LogFormatConsole: 32 | newLogger = slog.New(clog.New( 33 | clog.WithWriter(w), 34 | clog.WithLevel(level.Level()), 35 | clog.WithReplaceAttr(filter), 36 | )) 37 | 38 | case option.LogFormatJSON: 39 | newLogger = slog.New(slog.NewJSONHandler(w, &slog.HandlerOptions{ 40 | Level: level.Level(), 41 | ReplaceAttr: filter, 42 | })) 43 | } 44 | 45 | mutex.Lock() 46 | defer mutex.Unlock() 47 | Logger = newLogger 48 | currentLogFormat = format.Format() 49 | } 50 | 51 | func ErrLog(err error) any { 52 | if err == nil { 53 | return nil 54 | } 55 | 56 | attrs := []any{ 57 | slog.String("message", err.Error()), 58 | } 59 | 60 | if goErr := goerr.Unwrap(err); goErr != nil { 61 | var values []any 62 | for k, v := range goErr.Values() { 63 | values = append(values, slog.Any(k, v)) 64 | } 65 | attrs = append(attrs, slog.Group("values", values...)) 66 | 67 | var stacktrace any 68 | if currentLogFormat == option.LogFormatJSON { 69 | var traces []string 70 | for _, st := range goErr.StackTrace() { 71 | traces = append(traces, fmt.Sprintf("%+v", st)) 72 | } 73 | stacktrace = traces 74 | } else { 75 | stacktrace = goErr.StackTrace() 76 | } 77 | 78 | attrs = append(attrs, slog.Any("stacktrace", stacktrace)) 79 | } 80 | 81 | return slog.Group("error", attrs...) 82 | } 83 | -------------------------------------------------------------------------------- /.github/workflows/image.yml: -------------------------------------------------------------------------------- 1 | name: Build and publish container image 2 | 3 | on: 4 | push: 5 | 6 | env: 7 | TAG_NAME: ghnotify:${{ github.sha }} 8 | GITHUB_IMAGE_REPO: ghcr.io/${{ github.repository_owner }}/ghnotify 9 | GITHUB_IMAGE_NAME: ghcr.io/${{ github.repository_owner }}/ghnotify:${{ github.sha }} 10 | GITHUB_IMAGE_LATEST: ghcr.io/${{ github.repository_owner }}/ghnotify:latest 11 | 12 | jobs: 13 | build: 14 | runs-on: ubuntu-latest 15 | if: github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/tags/') 16 | steps: 17 | - name: checkout 18 | uses: actions/checkout@v2 19 | - name: Set up Docker buildx 20 | uses: docker/setup-buildx-action@v1 21 | - name: Build Docker image 22 | run: docker build . -t ${{ env.GITHUB_IMAGE_LATEST }} 23 | - name: Login to GitHub Container Registry 24 | uses: docker/login-action@v1 25 | with: 26 | registry: ghcr.io 27 | username: ${{ github.repository_owner }} 28 | password: ${{ secrets.GITHUB_TOKEN }} 29 | - name: Push image 30 | run: docker push ${{ env.GITHUB_IMAGE_LATEST }} 31 | - name: Rename image (commit ID) 32 | run: docker tag ${{ env.GITHUB_IMAGE_LATEST }} ${{ env.GITHUB_IMAGE_NAME }} 33 | - name: Push image 34 | run: docker push ${{ env.GITHUB_IMAGE_NAME }} 35 | - name: Slack Notification 36 | uses: rtCamp/action-slack-notify@v2 37 | env: 38 | SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK }} 39 | SLACK_MESSAGE: "Published built ghnotify image: ${{ env.GITHUB_IMAGE_NAME }}" 40 | 41 | release: 42 | runs-on: ubuntu-latest 43 | if: startsWith(github.ref, 'refs/tags/') 44 | needs: build 45 | steps: 46 | - name: extract tag 47 | id: tag 48 | run: | 49 | TAG=$(echo ${{ github.ref }} | sed -e "s#refs/tags/##g") 50 | echo ::set-output name=tag::$TAG 51 | - name: Login to GitHub Container Registry 52 | uses: docker/login-action@v1 53 | with: 54 | registry: ghcr.io 55 | username: ${{ github.repository_owner }} 56 | password: ${{ secrets.GITHUB_TOKEN }} 57 | - name: Pull Docker image 58 | run: docker pull ${{ env.GITHUB_IMAGE_NAME }} 59 | - name: Rename Docker image (tag name) 60 | run: docker tag ${{ env.GITHUB_IMAGE_NAME }} "${{ env.GITHUB_IMAGE_REPO }}:${{ steps.tag.outputs.tag }}" 61 | - name: Push Docker image (tag name) 62 | run: docker push "${{ env.GITHUB_IMAGE_REPO }}:${{ steps.tag.outputs.tag }}" 63 | - name: Slack Notification 64 | uses: rtCamp/action-slack-notify@v2 65 | env: 66 | SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK }} 67 | SLACK_MESSAGE: "Published built ghnotify image: ${{ steps.tag.outputs.tag }}" 68 | -------------------------------------------------------------------------------- /pkg/controller/server/server.go: -------------------------------------------------------------------------------- 1 | package server 2 | 3 | import ( 4 | "context" 5 | "errors" 6 | "net/http" 7 | "os" 8 | "os/signal" 9 | "syscall" 10 | "time" 11 | 12 | "github.com/go-chi/chi" 13 | "github.com/go-chi/chi/middleware" 14 | "github.com/m-mizutani/ghnotify/pkg/domain/types" 15 | "github.com/m-mizutani/ghnotify/pkg/usecase" 16 | "github.com/m-mizutani/ghnotify/pkg/utils" 17 | "github.com/m-mizutani/goerr" 18 | "golang.org/x/exp/slog" 19 | ) 20 | 21 | type Server struct { 22 | uc *usecase.Usecase 23 | mux *chi.Mux 24 | } 25 | 26 | func New(uc *usecase.Usecase) *Server { 27 | r := chi.NewRouter() 28 | r.Use(middleware.RequestID) 29 | r.Use(middleware.Logger) 30 | r.Use(middleware.Recoverer) 31 | r.Use(middleware.Timeout(60 * time.Second)) 32 | 33 | r.Post("/webhook/github", serveGitHubWebhook(uc)) 34 | 35 | r.Get("/health", handleHealthCheckRequest()) 36 | 37 | return &Server{ 38 | uc: uc, 39 | mux: r, 40 | } 41 | } 42 | 43 | func (x *Server) Listen(addr string) error { 44 | utils.Logger.Info("start listening", slog.String("addr", addr)) 45 | server := &http.Server{Addr: addr, Handler: x.mux} 46 | 47 | errCh := make(chan error, 1) 48 | go func() { 49 | if err := server.ListenAndServe(); err != http.ErrServerClosed { 50 | errCh <- goerr.Wrap(err) 51 | } 52 | }() 53 | 54 | sigCh := make(chan os.Signal, 1) 55 | signal.Notify(sigCh, syscall.SIGTERM, os.Interrupt) 56 | 57 | select { 58 | case err := <-errCh: 59 | return err 60 | 61 | case sig := <-sigCh: 62 | utils.Logger.With("signal", sig).Info("recv signal and shutting down...") 63 | ctx, cancel := context.WithTimeout(context.Background(), 10*time.Second) 64 | defer cancel() 65 | if err := server.Shutdown(ctx); err != nil { 66 | return goerr.Wrap(err) 67 | } 68 | } 69 | 70 | return nil 71 | } 72 | 73 | func (x *Server) ServeHTTP(w http.ResponseWriter, r *http.Request) { 74 | x.mux.ServeHTTP(w, r) 75 | } 76 | 77 | func handleError(w http.ResponseWriter, err error) { 78 | code := http.StatusInternalServerError 79 | switch { 80 | case errors.Is(err, types.ErrInvalidWebhookRequest): 81 | code = http.StatusBadRequest 82 | } 83 | 84 | w.WriteHeader(code) 85 | if _, err := w.Write([]byte(err.Error())); err != nil { 86 | utils.Logger.Error("fail to write error response", utils.ErrLog(err)) 87 | } 88 | } 89 | 90 | func toCtx(r *http.Request) *types.Context { 91 | ctx := r.Context() 92 | if c, ok := ctx.(*types.Context); ok { 93 | return c 94 | } 95 | return types.NewContext(types.WithCtx(ctx)) 96 | } 97 | 98 | func serveGitHubWebhook(uc *usecase.Usecase) http.HandlerFunc { 99 | return func(w http.ResponseWriter, r *http.Request) { 100 | if err := handleGitHubWebhook(uc, r); err != nil { 101 | handleError(w, err) 102 | return 103 | } 104 | 105 | w.WriteHeader(http.StatusOK) 106 | if _, err := w.Write([]byte("ok")); err != nil { 107 | utils.Logger.Error("fail to write response", utils.ErrLog(err)) 108 | } 109 | } 110 | } 111 | -------------------------------------------------------------------------------- /pkg/controller/server/webhook_test.go: -------------------------------------------------------------------------------- 1 | package server_test 2 | 3 | import ( 4 | "bytes" 5 | "crypto/hmac" 6 | "crypto/sha256" 7 | "encoding/hex" 8 | "encoding/json" 9 | "io" 10 | "net/http" 11 | "net/http/httptest" 12 | "testing" 13 | 14 | "github.com/google/go-github/v43/github" 15 | "github.com/m-mizutani/ghnotify/pkg/controller/server" 16 | "github.com/m-mizutani/ghnotify/pkg/domain/model" 17 | "github.com/m-mizutani/ghnotify/pkg/domain/types" 18 | "github.com/m-mizutani/ghnotify/pkg/infra" 19 | "github.com/m-mizutani/ghnotify/pkg/infra/notify" 20 | "github.com/m-mizutani/ghnotify/pkg/usecase" 21 | "github.com/m-mizutani/opac" 22 | "github.com/slack-go/slack" 23 | "github.com/stretchr/testify/assert" 24 | "github.com/stretchr/testify/require" 25 | ) 26 | 27 | func bind(secret string, data interface{}) (string, io.Reader) { 28 | raw, err := json.Marshal(data) 29 | if err != nil { 30 | panic(err.Error()) 31 | } 32 | 33 | mac := hmac.New(sha256.New, []byte(secret)) 34 | mac.Write(raw) 35 | signature := mac.Sum(nil) 36 | 37 | return "sha256=" + hex.EncodeToString(signature), bytes.NewReader(raw) 38 | } 39 | 40 | func TestWebhook(t *testing.T) { 41 | secret := "blue" 42 | var calledOPA, calledSlack int 43 | opaMock := opac.NewMock(func(in interface{}) (interface{}, error) { 44 | calledOPA++ 45 | input, ok := in.(*model.RegoInput) 46 | require.True(t, ok) 47 | assert.Equal(t, "issue_comment", input.Name) 48 | 49 | event, ok := input.Event.(*github.IssueCommentEvent) 50 | require.True(t, ok) 51 | assert.Equal(t, "test-repo", event.Repo.GetName()) 52 | return &model.RegoResult{ 53 | Notify: []*model.Notify{ 54 | { 55 | Channel: "#testing", 56 | Text: "hello", 57 | Color: "#123456", 58 | Body: "body", 59 | Fields: []*model.NotifyField{ 60 | { 61 | Name: "color", 62 | Value: "blue", 63 | URL: "https://example.com", 64 | }, 65 | { 66 | Name: "read_only", 67 | Value: true, 68 | }, 69 | }, 70 | }, 71 | }, 72 | }, nil 73 | }) 74 | 75 | slackMock := notify.NewSlackWebhookMock() 76 | slackMock.PostMock = func(ctx *types.Context, msg *slack.WebhookMessage) error { 77 | calledSlack++ 78 | return nil 79 | } 80 | 81 | clients := infra.New(infra.WithOPAC(opaMock), infra.WithSlack(slackMock)) 82 | uc := usecase.New(&model.Config{WebhookSecret: secret}, clients) 83 | srv := server.New(uc) 84 | 85 | { 86 | w := httptest.NewRecorder() 87 | sig, body := bind(secret, github.IssueCommentEvent{ 88 | Repo: &github.Repository{ 89 | Name: github.String("test-repo"), 90 | }, 91 | }) 92 | r := httptest.NewRequest("POST", "/webhook/github", body) 93 | r.Header.Add("X-GitHub-Event", "issue_comment") 94 | r.Header.Add("X-Hub-Signature-256", sig) 95 | 96 | srv.ServeHTTP(w, r) 97 | assert.Equal(t, http.StatusOK, w.Result().StatusCode) 98 | } 99 | 100 | assert.Equal(t, 1, calledOPA) 101 | assert.Equal(t, 1, calledSlack) 102 | } 103 | -------------------------------------------------------------------------------- /go.mod: -------------------------------------------------------------------------------- 1 | module github.com/m-mizutani/ghnotify 2 | 3 | go 1.20 4 | 5 | require ( 6 | github.com/go-chi/chi v1.5.4 7 | github.com/google/go-github/v43 v43.0.0 8 | github.com/m-mizutani/alertchain v0.0.6 9 | github.com/m-mizutani/clog v0.0.2 10 | github.com/m-mizutani/goerr v0.1.8 11 | github.com/m-mizutani/masq v0.1.1 12 | github.com/m-mizutani/opac v0.1.2 13 | github.com/slack-go/slack v0.12.2 14 | github.com/stretchr/testify v1.8.3 15 | github.com/urfave/cli/v2 v2.25.7 16 | golang.org/x/exp v0.0.0-20230626212559-97b1e661b5df 17 | google.golang.org/api v0.129.0 18 | ) 19 | 20 | require ( 21 | cloud.google.com/go/compute v1.20.1 // indirect 22 | cloud.google.com/go/compute/metadata v0.2.3 // indirect 23 | github.com/OneOfOne/xxhash v1.2.8 // indirect 24 | github.com/agnivade/levenshtein v1.1.1 // indirect 25 | github.com/asaskevich/govalidator v0.0.0-20230301143203-a9d515a09cc2 // indirect 26 | github.com/cpuguy83/go-md2man/v2 v2.0.2 // indirect 27 | github.com/davecgh/go-spew v1.1.1 // indirect 28 | github.com/fatih/color v1.15.0 // indirect 29 | github.com/ghodss/yaml v1.0.0 // indirect 30 | github.com/go-ozzo/ozzo-validation/v4 v4.3.0 // indirect 31 | github.com/gobwas/glob v0.2.3 // indirect 32 | github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da // indirect 33 | github.com/golang/protobuf v1.5.3 // indirect 34 | github.com/google/go-querystring v1.1.0 // indirect 35 | github.com/google/s2a-go v0.1.4 // indirect 36 | github.com/google/uuid v1.3.0 // indirect 37 | github.com/googleapis/enterprise-certificate-proxy v0.2.5 // indirect 38 | github.com/gorilla/websocket v1.5.0 // indirect 39 | github.com/k0kubun/colorstring v0.0.0-20150214042306-9440f1994b88 // indirect 40 | github.com/k0kubun/pp/v3 v3.2.0 // indirect 41 | github.com/m-mizutani/zlog v0.3.4 // indirect 42 | github.com/mattn/go-colorable v0.1.13 // indirect 43 | github.com/mattn/go-isatty v0.0.19 // indirect 44 | github.com/open-policy-agent/opa v0.52.0 // indirect 45 | github.com/pkg/errors v0.9.1 // indirect 46 | github.com/pmezard/go-difflib v1.0.0 // indirect 47 | github.com/prometheus/client_golang v1.16.0 // indirect 48 | github.com/prometheus/client_model v0.4.0 // indirect 49 | github.com/prometheus/common v0.44.0 // indirect 50 | github.com/prometheus/procfs v0.11.0 // indirect 51 | github.com/rcrowley/go-metrics v0.0.0-20201227073835-cf1acfcdf475 // indirect 52 | github.com/rogpeppe/go-internal v1.10.0 // indirect 53 | github.com/russross/blackfriday/v2 v2.1.0 // indirect 54 | github.com/sirupsen/logrus v1.9.3 // indirect 55 | github.com/tchap/go-patricia/v2 v2.3.1 // indirect 56 | github.com/xeipuuv/gojsonpointer v0.0.0-20190905194746-02993c407bfb // indirect 57 | github.com/xeipuuv/gojsonreference v0.0.0-20180127040603-bd5ef7bd5415 // indirect 58 | github.com/xrash/smetrics v0.0.0-20201216005158-039620a65673 // indirect 59 | github.com/yashtewari/glob-intersection v0.2.0 // indirect 60 | go.opencensus.io v0.24.0 // indirect 61 | golang.org/x/crypto v0.31.0 // indirect 62 | golang.org/x/net v0.21.0 // indirect 63 | golang.org/x/oauth2 v0.9.0 // indirect 64 | golang.org/x/sys v0.28.0 // indirect 65 | golang.org/x/text v0.21.0 // indirect 66 | google.golang.org/appengine v1.6.7 // indirect 67 | google.golang.org/genproto/googleapis/rpc v0.0.0-20230629202037-9506855d4529 // indirect 68 | google.golang.org/grpc v1.56.1 // indirect 69 | google.golang.org/protobuf v1.31.0 // indirect 70 | gopkg.in/yaml.v2 v2.4.0 // indirect 71 | gopkg.in/yaml.v3 v3.0.1 // indirect 72 | ) 73 | -------------------------------------------------------------------------------- /pkg/usecase/github_event.go: -------------------------------------------------------------------------------- 1 | package usecase 2 | 3 | import ( 4 | "encoding/json" 5 | "fmt" 6 | 7 | "github.com/google/go-github/v43/github" 8 | "github.com/m-mizutani/ghnotify/pkg/domain/model" 9 | "github.com/m-mizutani/ghnotify/pkg/domain/types" 10 | "github.com/m-mizutani/goerr" 11 | "github.com/slack-go/slack" 12 | ) 13 | 14 | func (x *Usecase) HandleGitHubEvent(ctx *types.Context, eventType string, body []byte) error { 15 | eventData, err := github.ParseWebHook(eventType, body) 16 | if err != nil { 17 | return goerr.Wrap(err).With("body", string(body)) 18 | } 19 | 20 | input := &model.RegoInput{ 21 | Name: eventType, 22 | Event: eventData, 23 | } 24 | var result model.RegoResult 25 | 26 | if err := x.clients.OPAC().Query(ctx, input, &result); err != nil { 27 | return goerr.Wrap(err) 28 | } 29 | ctx.Log().With("result", result).Debug("Policy evaluated") 30 | 31 | for _, notify := range result.Notify { 32 | msg := buildSlackMessage(notify, eventData) 33 | msg.Channel = notify.Channel 34 | 35 | rawMsg, _ := json.Marshal(msg) 36 | ctx.Log().With("msg", string(rawMsg)).Debug("notifying to slack") 37 | 38 | if err := x.clients.Slack().Post(ctx, msg); err != nil { 39 | return err 40 | } 41 | } 42 | 43 | return nil 44 | } 45 | 46 | func toBlock(field *model.NotifyField) *slack.TextBlockObject { 47 | text := fmt.Sprintf("*%s*: ", field.Name) 48 | valueStr := fmt.Sprintf("%+v", field.Value) 49 | 50 | if field.URL != "" { 51 | text += fmt.Sprintf("<%s|%s>", field.URL, valueStr) 52 | } else { 53 | text += valueStr 54 | } 55 | return slack.NewTextBlockObject(slack.MarkdownType, text, false, false) 56 | } 57 | 58 | func buildCommonFields(event interface{}) []*slack.TextBlockObject { 59 | body, err := json.Marshal(event) 60 | if err != nil { 61 | panic("failed to marshal github event: " + err.Error()) 62 | } 63 | 64 | var data struct { 65 | Repository *github.Repository `json:"repository,omitempty"` 66 | Issue *github.Issue `json:"issue,omitempty"` 67 | PullRequest *github.PullRequest `json:"pull_request,omitempty"` 68 | Sender *github.User `json:"sender,omitempty"` 69 | } 70 | 71 | if err := json.Unmarshal(body, &data); err != nil { 72 | panic("failed to unmarshal github event: " + err.Error()) 73 | } 74 | 75 | var blocks []*slack.TextBlockObject 76 | if data.Repository != nil { 77 | blocks = append(blocks, toBlock(&model.NotifyField{ 78 | Name: "Repo", 79 | Value: data.Repository.GetFullName(), 80 | URL: data.Repository.GetHTMLURL(), 81 | })) 82 | } 83 | 84 | if data.Issue != nil { 85 | blocks = append(blocks, toBlock(&model.NotifyField{ 86 | Name: "Issue", 87 | Value: fmt.Sprintf("#%d %s", data.Issue.GetNumber(), data.Issue.GetTitle()), 88 | URL: data.Issue.GetHTMLURL(), 89 | })) 90 | } 91 | 92 | if data.PullRequest != nil { 93 | blocks = append(blocks, toBlock(&model.NotifyField{ 94 | Name: "Pull Request", 95 | Value: fmt.Sprintf("#%d %s", data.PullRequest.GetNumber(), data.PullRequest.GetTitle()), 96 | URL: data.PullRequest.GetHTMLURL(), 97 | })) 98 | } 99 | 100 | if data.Sender != nil { 101 | blocks = append(blocks, toBlock(&model.NotifyField{ 102 | Name: "Sender", 103 | Value: data.Sender.GetLogin(), 104 | URL: data.Sender.GetHTMLURL(), 105 | })) 106 | } 107 | 108 | return blocks 109 | } 110 | 111 | func buildSlackMessage(notify *model.Notify, event interface{}) *slack.WebhookMessage { 112 | 113 | color := "#2EB67D" 114 | if notify.Color != "" { 115 | color = notify.Color 116 | } 117 | 118 | var blocks []slack.Block 119 | 120 | if fields := buildCommonFields(event); len(fields) > 0 { 121 | blocks = append(blocks, slack.NewSectionBlock(nil, fields, nil)) 122 | } 123 | 124 | if notify.Body != "" { 125 | blocks = append(blocks, 126 | slack.NewDividerBlock(), 127 | slack.NewSectionBlock(&slack.TextBlockObject{ 128 | Type: slack.PlainTextType, 129 | Text: notify.Body, 130 | }, nil, nil), 131 | ) 132 | } 133 | 134 | var customFields []*slack.TextBlockObject 135 | for _, field := range notify.Fields { 136 | customFields = append(customFields, toBlock(field)) 137 | } 138 | if len(customFields) > 0 { 139 | blocks = append(blocks, 140 | slack.NewDividerBlock(), 141 | slack.NewSectionBlock(nil, customFields, nil), 142 | ) 143 | } 144 | 145 | msg := &slack.WebhookMessage{ 146 | Text: notify.Text, 147 | Attachments: []slack.Attachment{ 148 | { 149 | Color: color, 150 | Blocks: slack.Blocks{ 151 | BlockSet: blocks, 152 | }, 153 | }, 154 | }, 155 | } 156 | 157 | return msg 158 | } 159 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # ghnotify 2 | 3 | `ghnotify` is a general GitHub event notification tool to Slack with [Open Policy Agent](https://github.com/open-policy-agent/opa) and [Rego](https://www.openpolicyagent.org/docs/latest/policy-language/). There are a lot of notification tools from GitHub to Slack. However, in most case, notification rules are deeply integrated with source code implementation and customization of notification rule by end-user is limited. 4 | 5 | `ghnotify` uses generic policy language Rego and OPA as runtime to separate implementation and policy completely. Therefore, `ghnotify` can handle and notify **all type of GitHub event**, not only issue/PR comments but also such as following events according to your Rego policy. 6 | 7 | - GitHub Actions success/failure 8 | - deploy key creation 9 | - push to specified branch 10 | - add/remove a label 11 | - repository creation, archived, transferred 12 | - team modification 13 | - a new GitHub App installation 14 | 15 | ## Setup 16 | 17 | ### 1) Retrieve Bot User OAuth Token of Slack 18 | 19 | Create your Slack bot and keep *OAuth Tokens for Your Workspace* in *OAuth & Permissions* page. 20 | 21 | ### 2) Creating Rego policy 22 | 23 | `ghnotify` evaluates received GitHub event one by one. If `notify` variable exists in evaluation results, `ghnotify` notifies a message to Slack according to the results. 24 | 25 | Policy rules are following. 26 | 27 | **Input**: What data will be provided 28 | - `input.name`: Event name. It comes from `X-GitHub-Event` header. 29 | - `input.event`: Webhook events. See [docs](https://docs.github.com/en/developers/webhooks-and-events/webhooks) for more detail and schema. 30 | 31 | **Result**: What data should be returned 32 | - `notify`: Set of notification messages 33 | - `notify[_].channel`: Destination channel of Slack. It can be used by only API token 34 | - `notify[_].text`: Custom message of slack notification 35 | - `notify[_].body`: Custom message body 36 | - `notify[_].color`: Message bar color 37 | - `notify[_].fields`: Set of custom message fields. 38 | - `notify[_].fields[_].name`: Field name 39 | - `notify[_].fields[_].value`: Field value 40 | - `notify[_].fields[_].url`: Link assigned to the field 41 | 42 | #### Example 1) Notification of "call me" in issue comment 43 | 44 | ```rego 45 | package github.notify 46 | 47 | notify[msg] { 48 | input.name == "issue_comment" 49 | contains(input.event.comment.body, "mizutani") 50 | msg := { 51 | "channel": "#notify-mizutani", 52 | "text": "Hello, mizutani", 53 | "body": input.event.comment.body, 54 | } 55 | } 56 | ``` 57 | 58 | Then, you shall get a message like following. 59 | 60 | ![](https://user-images.githubusercontent.com/605953/155864886-c9c8ccbb-809c-44df-8925-fe69a0d820f4.png) 61 | 62 | 63 | #### Example 2) Notification of workflow (actions) failed 64 | 65 | ```rego 66 | package github.notify 67 | 68 | notify[msg] { 69 | input.name == "workflow_run" 70 | input.event.action == "completed" 71 | input.event.conclusion == "failure" 72 | 73 | msg := { 74 | "channel": "#notify-failure", 75 | "text": "workflow failed", 76 | "color": "#E01E5A", # red 77 | } 78 | } 79 | ``` 80 | 81 | #### Example 3) Assigned "breaking-change" label to PR 82 | 83 | ```rego 84 | package github.notify 85 | 86 | notify[msg] { 87 | input.name == "pull_request" 88 | input.event.action == "labeled" 89 | input.event.label.name == "breaking-change" 90 | labels := { name | name := input.event.pull_request.labels[_].name } 91 | 92 | msg := { 93 | "channel": "#notify-mizutani", 94 | "text": "breaking change assigned", 95 | "fields": [ 96 | { 97 | "name": "All labels", 98 | "value": concat(", ", labels), 99 | }, 100 | ], 101 | } 102 | } 103 | ``` 104 | 105 | ## Run 106 | 107 | ### Use Case 1: As GitHub Actions 108 | 109 | - Pros: Easy to install 110 | - Cons: GitHub Actions can receive events from only the repository 111 | 112 | Create GitHub Actions workflow as following. 113 | 114 | ```yaml 115 | name: Build and publish container image 116 | 117 | on: 118 | push: 119 | issue: 120 | issue_comment: 121 | 122 | jobs: 123 | build: 124 | runs-on: ubuntu-latest 125 | env: 126 | GHNOTIFY_SLACK_API_TOKEN: ${{ secrets.GHNOTIFY_SLACK_API_TOKEN }} 127 | steps: 128 | - name: checkout 129 | uses: actions/checkout@v2 130 | - name: dump event 131 | run: echo '${{ toJSON(github.event) }}' > /tmp/event.json 132 | - uses: docker://ghcr.io/m-mizutani/ghnotify:latest 133 | with: 134 | args: "emit -f /tmp/event.json -t ${{ github.event_name }} --local-policy ./policy" 135 | ``` 136 | 137 | ### Use Case 2: As GitHub App server 138 | 139 | - Pros: Easy to install 140 | - Cons: GitHub Actions can receive event on each repository, can not watch organization wide 141 | 142 | #### Deploy `ghnotify` 143 | 144 | Deploy `ghnotify` to your environment and prepare URL that can be accessed from public internet. I recommend [Cloud Run](https://cloud.google.com/run) of Google Cloud in the use case. 145 | 146 | When deploying `ghnotify`, I recommend to generate and use *Webhook secret* value. Please prepare random token and provide it to `--webhook-secret`. 147 | 148 | Callback endpoint will be `http://{hostname}:4080/webhook/github`. You can change port number by `--addr` option. 149 | 150 | #### Create a new GitHub App 151 | 152 | 1. Go to https://github.com/settings/apps and click `New GitHub App` 153 | 2. Grant permissions and check events you want to subscribe in `Subscribe to events`. 154 | 3. Check `Active` in `Webhook` section 155 | 4. Set URL of deployed `ghnotify` to `Webhook URL` 156 | 5. Set *Webhook secret* to `Webhook secret` if you configured 157 | 6. Then click `Create GitHub App` 158 | 159 | #### Example 160 | 161 | ## Options 162 | 163 | - Server 164 | - `--addr`: Server address and port to listen webhook. e.g. `0.0.0.0:8080` 165 | - `--webhook-secret`: Webhook secret 166 | - Policy (either one of `--local-policy` and `--remote-url` is required) 167 | - `--local-policy`: Policy files or directory. 168 | - `--local-package`: Package name of policy file 169 | - `--remote-url`: URL of OPA server 170 | - `--remote-header`: HTTP header to query OPA server 171 | - Notification (either one of following is required) 172 | - `--slack-api-token`: API token retrieved in Step 1 (Recommended) 173 | - `--slack-webhook`: Incoming webhook URL of Slack 174 | 175 | ## License 176 | 177 | Apache License 2.0 178 | -------------------------------------------------------------------------------- /pkg/controller/cmd/cli.go: -------------------------------------------------------------------------------- 1 | package cmd 2 | 3 | import ( 4 | "net/http" 5 | "strings" 6 | 7 | "github.com/m-mizutani/ghnotify/pkg/controller/cmd/option" 8 | "github.com/m-mizutani/ghnotify/pkg/domain/model" 9 | "github.com/m-mizutani/ghnotify/pkg/domain/types" 10 | "github.com/m-mizutani/ghnotify/pkg/infra" 11 | "github.com/m-mizutani/ghnotify/pkg/infra/notify" 12 | "github.com/m-mizutani/ghnotify/pkg/usecase" 13 | "github.com/m-mizutani/ghnotify/pkg/utils" 14 | "github.com/m-mizutani/goerr" 15 | "github.com/m-mizutani/opac" 16 | "github.com/urfave/cli/v2" 17 | "google.golang.org/api/idtoken" 18 | ) 19 | 20 | type globalConfig struct { 21 | SlackWebhookURL string 22 | SlackAPIToken string `masq:"secret"` 23 | GitHubWebhookSecret string `masq:"secret"` 24 | 25 | LocalPolicy string 26 | LocalPackage string 27 | RemoteURL string 28 | RemoteHeaders []string 29 | 30 | remoteHeaders cli.StringSlice 31 | 32 | remoteIDTokenClient bool 33 | } 34 | 35 | type idTokenClient struct{} 36 | 37 | func (x *idTokenClient) Do(req *http.Request) (*http.Response, error) { 38 | client, err := idtoken.NewClient(req.Context(), req.URL.String()) 39 | if err != nil { 40 | return nil, goerr.Wrap(err, "failed idtoken.NewClient for GCP IAP").With("req", req) 41 | } 42 | 43 | return client.Do(req) 44 | } 45 | 46 | func (x *globalConfig) newUsecase() (*usecase.Usecase, error) { 47 | cfg := &model.Config{ 48 | WebhookSecret: x.GitHubWebhookSecret, 49 | } 50 | 51 | // Configure slack client 52 | var slackClient notify.SlackClient 53 | if x.SlackWebhookURL != "" { 54 | slackClient = notify.NewSlackWebhook(x.SlackWebhookURL) 55 | } else if x.SlackAPIToken != "" { 56 | slackClient = notify.NewSlackAPI(x.SlackAPIToken) 57 | } else { 58 | return nil, goerr.Wrap(types.ErrInvalidConfig, "no slack config") 59 | } 60 | 61 | // Configure policy client 62 | var opacClient opac.Client 63 | if x.LocalPolicy != "" { 64 | options := []opac.LocalOption{opac.WithDir(x.LocalPolicy)} 65 | if x.LocalPackage != "" { 66 | options = append(options, opac.WithPackage(x.LocalPackage)) 67 | } 68 | client, err := opac.NewLocal(options...) 69 | if err != nil { 70 | return nil, goerr.Wrap(err) 71 | } 72 | opacClient = client 73 | } else if x.RemoteURL != "" { 74 | options := []opac.RemoteOption{} 75 | for _, hdr := range x.RemoteHeaders { 76 | parts := strings.SplitN(hdr, ":", 2) 77 | if len(parts) != 2 { 78 | return nil, goerr.Wrap(types.ErrInvalidConfig, "invalid header format").With("hdr", hdr) 79 | } 80 | options = append(options, opac.WithHTTPHeader( 81 | strings.TrimSpace(parts[0]), 82 | strings.TrimSpace(parts[1]), 83 | )) 84 | } 85 | 86 | if x.remoteIDTokenClient { 87 | options = append(options, opac.WithHTTPClient(&idTokenClient{})) 88 | } 89 | 90 | client, err := opac.NewRemote(x.RemoteURL, options...) 91 | if err != nil { 92 | return nil, goerr.Wrap(err) 93 | } 94 | opacClient = client 95 | } else { 96 | return nil, goerr.Wrap(types.ErrInvalidConfig, "no policy config") 97 | } 98 | 99 | clients := infra.New( 100 | infra.WithSlack(slackClient), 101 | infra.WithOPAC(opacClient), 102 | ) 103 | return usecase.New(cfg, clients), nil 104 | } 105 | 106 | func Run(argv []string) error { 107 | var ( 108 | cfg globalConfig 109 | 110 | logLevel option.LogLevel 111 | logFormat option.LogFormat 112 | logOutput option.LogOutput 113 | ) 114 | 115 | app := &cli.App{ 116 | Name: "ghnotify", 117 | Usage: "General GitHub event notification tool to Slack with Open Policy Agent and Rego", 118 | Flags: []cli.Flag{ 119 | &cli.StringFlag{ 120 | Name: "local-policy", 121 | Usage: "Rego local policy directory", 122 | EnvVars: []string{"GHNOTIFY_LOCAL_POLICY"}, 123 | Destination: &cfg.LocalPolicy, 124 | }, 125 | &cli.StringFlag{ 126 | Name: "local-package", 127 | Usage: "Rego local policy package", 128 | EnvVars: []string{"GHNOTIFY_LOCAL_PACKAGE"}, 129 | Destination: &cfg.LocalPackage, 130 | Value: "github.notify", 131 | }, 132 | &cli.StringFlag{ 133 | Name: "remote-url", 134 | Usage: "OPA server URL", 135 | EnvVars: []string{"GHNOTIFY_REMOTE_URL"}, 136 | Destination: &cfg.RemoteURL, 137 | }, 138 | &cli.StringSliceFlag{ 139 | Name: "remote-header", 140 | Usage: "HTTP Header (format: `HeaderName: HeaderValue`)", 141 | EnvVars: []string{"GHNOTIFY_REMOTE_HEADER"}, 142 | Destination: &cfg.remoteHeaders, 143 | }, 144 | &cli.BoolFlag{ 145 | Name: "remote-idtoken-client", 146 | Usage: "Enable IDToken client", 147 | EnvVars: []string{"GHNOTIFY_REMOTE_IDTOKEN_CLIENT"}, 148 | Destination: &cfg.remoteIDTokenClient, 149 | }, 150 | 151 | &cli.StringFlag{ 152 | Name: "slack-webhook", 153 | Usage: "Slack incoming webhook", 154 | EnvVars: []string{"GHNOTIFY_SLACK_WEBHOOK"}, 155 | Destination: &cfg.SlackWebhookURL, 156 | }, 157 | &cli.StringFlag{ 158 | Name: "slack-api-token", 159 | Usage: "Slack API token", 160 | EnvVars: []string{"GHNOTIFY_SLACK_API_TOKEN"}, 161 | Destination: &cfg.SlackAPIToken, 162 | }, 163 | 164 | &cli.GenericFlag{ 165 | Name: "log-level", 166 | Category: "logging", 167 | Aliases: []string{"l"}, 168 | Usage: "Log level [debug|info|warn|error]", 169 | EnvVars: []string{"GHNOTIFY_LOG_LEVEL"}, 170 | Destination: &logLevel, 171 | Value: &logLevel, 172 | }, 173 | &cli.GenericFlag{ 174 | Name: "log-format", 175 | Category: "logging", 176 | Aliases: []string{"f"}, 177 | Usage: "Log format [console|json]", 178 | EnvVars: []string{"GHNOTIFY_LOG_FORMAT"}, 179 | Destination: &logFormat, 180 | Value: &logFormat, 181 | }, 182 | &cli.GenericFlag{ 183 | Name: "log-output", 184 | Category: "logging", 185 | Aliases: []string{"o"}, 186 | Usage: "Log output [stdout|stderr]", 187 | EnvVars: []string{"GHNOTIFY_LOG_OUTPUT"}, 188 | Destination: &logOutput, 189 | Value: &logOutput, 190 | }, 191 | }, 192 | Commands: []*cli.Command{ 193 | cmdServe(&cfg), 194 | cmdEmit(&cfg), 195 | }, 196 | Before: func(ctx *cli.Context) error { 197 | cfg.RemoteHeaders = cfg.remoteHeaders.Value() 198 | 199 | utils.RenewLogger(logOutput.Writer(), logLevel, logFormat) 200 | 201 | utils.Logger.With("config", cfg).Debug("Starting...") 202 | 203 | return nil 204 | }, 205 | } 206 | 207 | if err := app.Run(argv); err != nil { 208 | utils.Logger.Error(err.Error()) 209 | return err 210 | } 211 | return nil 212 | } 213 | -------------------------------------------------------------------------------- /examples/data/issue.json: -------------------------------------------------------------------------------- 1 | { 2 | "action": "opened", 3 | "issue": { 4 | "url": "https://api.github.com/repos/mizutani-sandbox/test-repo/issues/1", 5 | "repository_url": "https://api.github.com/repos/mizutani-sandbox/test-repo", 6 | "labels_url": "https://api.github.com/repos/mizutani-sandbox/test-repo/issues/1/labels{/name}", 7 | "comments_url": "https://api.github.com/repos/mizutani-sandbox/test-repo/issues/1/comments", 8 | "events_url": "https://api.github.com/repos/mizutani-sandbox/test-repo/issues/1/events", 9 | "html_url": "https://github.com/mizutani-sandbox/test-repo/issues/1", 10 | "id": 1160489301, 11 | "node_id": "I_kwDOG3sIx85FK6lV", 12 | "number": 1, 13 | "title": "test issue", 14 | "user": { 15 | "login": "m-mizutani", 16 | "id": 605953, 17 | "node_id": "MDQ6VXNlcjYwNTk1Mw==", 18 | "avatar_url": "https://avatars.githubusercontent.com/u/605953?v=4", 19 | "gravatar_id": "", 20 | "url": "https://api.github.com/users/m-mizutani", 21 | "html_url": "https://github.com/m-mizutani", 22 | "followers_url": "https://api.github.com/users/m-mizutani/followers", 23 | "following_url": "https://api.github.com/users/m-mizutani/following{/other_user}", 24 | "gists_url": "https://api.github.com/users/m-mizutani/gists{/gist_id}", 25 | "starred_url": "https://api.github.com/users/m-mizutani/starred{/owner}{/repo}", 26 | "subscriptions_url": "https://api.github.com/users/m-mizutani/subscriptions", 27 | "organizations_url": "https://api.github.com/users/m-mizutani/orgs", 28 | "repos_url": "https://api.github.com/users/m-mizutani/repos", 29 | "events_url": "https://api.github.com/users/m-mizutani/events{/privacy}", 30 | "received_events_url": "https://api.github.com/users/m-mizutani/received_events", 31 | "type": "User", 32 | "site_admin": false 33 | }, 34 | "labels": [ 35 | { 36 | "id": 3848140920, 37 | "node_id": "LA_kwDOG3sIx87lXfh4", 38 | "url": "https://api.github.com/repos/mizutani-sandbox/test-repo/labels/good%20first%20issue", 39 | "name": "good first issue", 40 | "color": "7057ff", 41 | "default": true, 42 | "description": "Good for newcomers" 43 | } 44 | ], 45 | "state": "open", 46 | "locked": false, 47 | "assignee": null, 48 | "assignees": [], 49 | "milestone": null, 50 | "comments": 0, 51 | "created_at": "2022-03-06T01:21:42Z", 52 | "updated_at": "2022-03-06T01:21:42Z", 53 | "closed_at": null, 54 | "author_association": "CONTRIBUTOR", 55 | "active_lock_reason": null, 56 | "body": "this is test issue, please ignore me", 57 | "reactions": { 58 | "url": "https://api.github.com/repos/mizutani-sandbox/test-repo/issues/1/reactions", 59 | "total_count": 0, 60 | "+1": 0, 61 | "-1": 0, 62 | "laugh": 0, 63 | "hooray": 0, 64 | "confused": 0, 65 | "heart": 0, 66 | "rocket": 0, 67 | "eyes": 0 68 | }, 69 | "timeline_url": "https://api.github.com/repos/mizutani-sandbox/test-repo/issues/1/timeline", 70 | "performed_via_github_app": null 71 | }, 72 | "repository": { 73 | "id": 461048007, 74 | "node_id": "R_kgDOG3sIxw", 75 | "name": "test-repo", 76 | "full_name": "mizutani-sandbox/test-repo", 77 | "private": false, 78 | "owner": { 79 | "login": "mizutani-sandbox", 80 | "id": 84258961, 81 | "node_id": "MDEyOk9yZ2FuaXphdGlvbjg0MjU4OTYx", 82 | "avatar_url": "https://avatars.githubusercontent.com/u/84258961?v=4", 83 | "gravatar_id": "", 84 | "url": "https://api.github.com/users/mizutani-sandbox", 85 | "html_url": "https://github.com/mizutani-sandbox", 86 | "followers_url": "https://api.github.com/users/mizutani-sandbox/followers", 87 | "following_url": "https://api.github.com/users/mizutani-sandbox/following{/other_user}", 88 | "gists_url": "https://api.github.com/users/mizutani-sandbox/gists{/gist_id}", 89 | "starred_url": "https://api.github.com/users/mizutani-sandbox/starred{/owner}{/repo}", 90 | "subscriptions_url": "https://api.github.com/users/mizutani-sandbox/subscriptions", 91 | "organizations_url": "https://api.github.com/users/mizutani-sandbox/orgs", 92 | "repos_url": "https://api.github.com/users/mizutani-sandbox/repos", 93 | "events_url": "https://api.github.com/users/mizutani-sandbox/events{/privacy}", 94 | "received_events_url": "https://api.github.com/users/mizutani-sandbox/received_events", 95 | "type": "Organization", 96 | "site_admin": false 97 | }, 98 | "html_url": "https://github.com/mizutani-sandbox/test-repo", 99 | "description": "for testing", 100 | "fork": false, 101 | "url": "https://api.github.com/repos/mizutani-sandbox/test-repo", 102 | "forks_url": "https://api.github.com/repos/mizutani-sandbox/test-repo/forks", 103 | "keys_url": "https://api.github.com/repos/mizutani-sandbox/test-repo/keys{/key_id}", 104 | "collaborators_url": "https://api.github.com/repos/mizutani-sandbox/test-repo/collaborators{/collaborator}", 105 | "teams_url": "https://api.github.com/repos/mizutani-sandbox/test-repo/teams", 106 | "hooks_url": "https://api.github.com/repos/mizutani-sandbox/test-repo/hooks", 107 | "issue_events_url": "https://api.github.com/repos/mizutani-sandbox/test-repo/issues/events{/number}", 108 | "events_url": "https://api.github.com/repos/mizutani-sandbox/test-repo/events", 109 | "assignees_url": "https://api.github.com/repos/mizutani-sandbox/test-repo/assignees{/user}", 110 | "branches_url": "https://api.github.com/repos/mizutani-sandbox/test-repo/branches{/branch}", 111 | "tags_url": "https://api.github.com/repos/mizutani-sandbox/test-repo/tags", 112 | "blobs_url": "https://api.github.com/repos/mizutani-sandbox/test-repo/git/blobs{/sha}", 113 | "git_tags_url": "https://api.github.com/repos/mizutani-sandbox/test-repo/git/tags{/sha}", 114 | "git_refs_url": "https://api.github.com/repos/mizutani-sandbox/test-repo/git/refs{/sha}", 115 | "trees_url": "https://api.github.com/repos/mizutani-sandbox/test-repo/git/trees{/sha}", 116 | "statuses_url": "https://api.github.com/repos/mizutani-sandbox/test-repo/statuses/{sha}", 117 | "languages_url": "https://api.github.com/repos/mizutani-sandbox/test-repo/languages", 118 | "stargazers_url": "https://api.github.com/repos/mizutani-sandbox/test-repo/stargazers", 119 | "contributors_url": "https://api.github.com/repos/mizutani-sandbox/test-repo/contributors", 120 | "subscribers_url": "https://api.github.com/repos/mizutani-sandbox/test-repo/subscribers", 121 | "subscription_url": "https://api.github.com/repos/mizutani-sandbox/test-repo/subscription", 122 | "commits_url": "https://api.github.com/repos/mizutani-sandbox/test-repo/commits{/sha}", 123 | "git_commits_url": "https://api.github.com/repos/mizutani-sandbox/test-repo/git/commits{/sha}", 124 | "comments_url": "https://api.github.com/repos/mizutani-sandbox/test-repo/comments{/number}", 125 | "issue_comment_url": "https://api.github.com/repos/mizutani-sandbox/test-repo/issues/comments{/number}", 126 | "contents_url": "https://api.github.com/repos/mizutani-sandbox/test-repo/contents/{+path}", 127 | "compare_url": "https://api.github.com/repos/mizutani-sandbox/test-repo/compare/{base}...{head}", 128 | "merges_url": "https://api.github.com/repos/mizutani-sandbox/test-repo/merges", 129 | "archive_url": "https://api.github.com/repos/mizutani-sandbox/test-repo/{archive_format}{/ref}", 130 | "downloads_url": "https://api.github.com/repos/mizutani-sandbox/test-repo/downloads", 131 | "issues_url": "https://api.github.com/repos/mizutani-sandbox/test-repo/issues{/number}", 132 | "pulls_url": "https://api.github.com/repos/mizutani-sandbox/test-repo/pulls{/number}", 133 | "milestones_url": "https://api.github.com/repos/mizutani-sandbox/test-repo/milestones{/number}", 134 | "notifications_url": "https://api.github.com/repos/mizutani-sandbox/test-repo/notifications{?since,all,participating}", 135 | "labels_url": "https://api.github.com/repos/mizutani-sandbox/test-repo/labels{/name}", 136 | "releases_url": "https://api.github.com/repos/mizutani-sandbox/test-repo/releases{/id}", 137 | "deployments_url": "https://api.github.com/repos/mizutani-sandbox/test-repo/deployments", 138 | "created_at": "2022-02-19T00:37:32Z", 139 | "updated_at": "2022-02-19T00:37:32Z", 140 | "pushed_at": "2022-02-23T02:54:36Z", 141 | "git_url": "git://github.com/mizutani-sandbox/test-repo.git", 142 | "ssh_url": "git@github.com:mizutani-sandbox/test-repo.git", 143 | "clone_url": "https://github.com/mizutani-sandbox/test-repo.git", 144 | "svn_url": "https://github.com/mizutani-sandbox/test-repo", 145 | "homepage": null, 146 | "size": 0, 147 | "stargazers_count": 0, 148 | "watchers_count": 0, 149 | "language": null, 150 | "has_issues": true, 151 | "has_projects": true, 152 | "has_downloads": true, 153 | "has_wiki": true, 154 | "has_pages": false, 155 | "forks_count": 0, 156 | "mirror_url": null, 157 | "archived": false, 158 | "disabled": false, 159 | "open_issues_count": 1, 160 | "license": null, 161 | "allow_forking": true, 162 | "is_template": false, 163 | "topics": [], 164 | "visibility": "public", 165 | "forks": 0, 166 | "open_issues": 1, 167 | "watchers": 0, 168 | "default_branch": "main" 169 | }, 170 | "organization": { 171 | "login": "mizutani-sandbox", 172 | "id": 84258961, 173 | "node_id": "MDEyOk9yZ2FuaXphdGlvbjg0MjU4OTYx", 174 | "url": "https://api.github.com/orgs/mizutani-sandbox", 175 | "repos_url": "https://api.github.com/orgs/mizutani-sandbox/repos", 176 | "events_url": "https://api.github.com/orgs/mizutani-sandbox/events", 177 | "hooks_url": "https://api.github.com/orgs/mizutani-sandbox/hooks", 178 | "issues_url": "https://api.github.com/orgs/mizutani-sandbox/issues", 179 | "members_url": "https://api.github.com/orgs/mizutani-sandbox/members{/member}", 180 | "public_members_url": "https://api.github.com/orgs/mizutani-sandbox/public_members{/member}", 181 | "avatar_url": "https://avatars.githubusercontent.com/u/84258961?v=4", 182 | "description": null 183 | }, 184 | "sender": { 185 | "login": "m-mizutani", 186 | "id": 605953, 187 | "node_id": "MDQ6VXNlcjYwNTk1Mw==", 188 | "avatar_url": "https://avatars.githubusercontent.com/u/605953?v=4", 189 | "gravatar_id": "", 190 | "url": "https://api.github.com/users/m-mizutani", 191 | "html_url": "https://github.com/m-mizutani", 192 | "followers_url": "https://api.github.com/users/m-mizutani/followers", 193 | "following_url": "https://api.github.com/users/m-mizutani/following{/other_user}", 194 | "gists_url": "https://api.github.com/users/m-mizutani/gists{/gist_id}", 195 | "starred_url": "https://api.github.com/users/m-mizutani/starred{/owner}{/repo}", 196 | "subscriptions_url": "https://api.github.com/users/m-mizutani/subscriptions", 197 | "organizations_url": "https://api.github.com/users/m-mizutani/orgs", 198 | "repos_url": "https://api.github.com/users/m-mizutani/repos", 199 | "events_url": "https://api.github.com/users/m-mizutani/events{/privacy}", 200 | "received_events_url": "https://api.github.com/users/m-mizutani/received_events", 201 | "type": "User", 202 | "site_admin": false 203 | }, 204 | "installation": { 205 | "id": 23850095, 206 | "node_id": "MDIzOkludGVncmF0aW9uSW5zdGFsbGF0aW9uMjM4NTAwOTU=" 207 | } 208 | } 209 | -------------------------------------------------------------------------------- /examples/data/check_suite.json: -------------------------------------------------------------------------------- 1 | { 2 | "action": "completed", 3 | "check_suite": { 4 | "id": 5547159555, 5 | "node_id": "CS_kwDOGwj3pc8AAAABSqLwAw", 6 | "head_branch": "main", 7 | "head_sha": "cd625cf9e07b61c8eeab36dd37fb619ffa2cf230", 8 | "status": "completed", 9 | "conclusion": "failure", 10 | "url": "https://api.github.com/repos/m-mizutani/gh-audit-poc/check-suites/5547159555", 11 | "before": "4817c6878dfefe14c14188f55f2f7fe2b0c51a06", 12 | "after": "cd625cf9e07b61c8eeab36dd37fb619ffa2cf230", 13 | "pull_requests": [], 14 | "app": { 15 | "id": 15368, 16 | "slug": "github-actions", 17 | "node_id": "MDM6QXBwMTUzNjg=", 18 | "owner": { 19 | "login": "github", 20 | "id": 9919, 21 | "node_id": "MDEyOk9yZ2FuaXphdGlvbjk5MTk=", 22 | "avatar_url": "https://avatars.githubusercontent.com/u/9919?v=4", 23 | "gravatar_id": "", 24 | "url": "https://api.github.com/users/github", 25 | "html_url": "https://github.com/github", 26 | "followers_url": "https://api.github.com/users/github/followers", 27 | "following_url": "https://api.github.com/users/github/following{/other_user}", 28 | "gists_url": "https://api.github.com/users/github/gists{/gist_id}", 29 | "starred_url": "https://api.github.com/users/github/starred{/owner}{/repo}", 30 | "subscriptions_url": "https://api.github.com/users/github/subscriptions", 31 | "organizations_url": "https://api.github.com/users/github/orgs", 32 | "repos_url": "https://api.github.com/users/github/repos", 33 | "events_url": "https://api.github.com/users/github/events{/privacy}", 34 | "received_events_url": "https://api.github.com/users/github/received_events", 35 | "type": "Organization", 36 | "site_admin": false 37 | }, 38 | "name": "GitHub Actions", 39 | "description": "Automate your workflow from idea to production", 40 | "external_url": "https://help.github.com/en/actions", 41 | "html_url": "https://github.com/apps/github-actions", 42 | "created_at": "2018-07-30T09:30:17Z", 43 | "updated_at": "2019-12-10T19:04:12Z", 44 | "permissions": { 45 | "actions": "write", 46 | "administration": "read", 47 | "checks": "write", 48 | "contents": "write", 49 | "deployments": "write", 50 | "discussions": "write", 51 | "issues": "write", 52 | "metadata": "read", 53 | "organization_packages": "write", 54 | "packages": "write", 55 | "pages": "write", 56 | "pull_requests": "write", 57 | "repository_hooks": "write", 58 | "repository_projects": "write", 59 | "security_events": "write", 60 | "statuses": "write", 61 | "vulnerability_alerts": "read" 62 | }, 63 | "events": [ 64 | "branch_protection_rule", 65 | "check_run", 66 | "check_suite", 67 | "create", 68 | "delete", 69 | "deployment", 70 | "deployment_status", 71 | "discussion", 72 | "discussion_comment", 73 | "fork", 74 | "gollum", 75 | "issues", 76 | "issue_comment", 77 | "label", 78 | "milestone", 79 | "page_build", 80 | "project", 81 | "project_card", 82 | "project_column", 83 | "public", 84 | "pull_request", 85 | "pull_request_review", 86 | "pull_request_review_comment", 87 | "push", 88 | "registry_package", 89 | "release", 90 | "repository", 91 | "repository_dispatch", 92 | "status", 93 | "watch", 94 | "workflow_dispatch", 95 | "workflow_run" 96 | ] 97 | }, 98 | "created_at": "2022-03-05T17:28:20Z", 99 | "updated_at": "2022-03-05T17:28:40Z", 100 | "rerequestable": true, 101 | "runs_rerequestable": false, 102 | "latest_check_runs_count": 1, 103 | "check_runs_url": "https://api.github.com/repos/m-mizutani/gh-audit-poc/check-suites/5547159555/check-runs", 104 | "head_commit": { 105 | "id": "cd625cf9e07b61c8eeab36dd37fb619ffa2cf230", 106 | "tree_id": "8afe653b23b20787256cc48b1ed8ddc893551140", 107 | "message": "use opaq docker image", 108 | "timestamp": "2022-01-30T03:26:51Z", 109 | "author": { 110 | "name": "Masayoshi Mizutani", 111 | "email": "masayoshi.mizutani@dr-ubie.com" 112 | }, 113 | "committer": { 114 | "name": "Masayoshi Mizutani", 115 | "email": "masayoshi.mizutani@dr-ubie.com" 116 | } 117 | } 118 | }, 119 | "repository": { 120 | "id": 453572517, 121 | "node_id": "R_kgDOGwj3pQ", 122 | "name": "gh-audit-poc", 123 | "full_name": "m-mizutani/gh-audit-poc", 124 | "private": false, 125 | "owner": { 126 | "login": "m-mizutani", 127 | "id": 605953, 128 | "node_id": "MDQ6VXNlcjYwNTk1Mw==", 129 | "avatar_url": "https://avatars.githubusercontent.com/u/605953?v=4", 130 | "gravatar_id": "", 131 | "url": "https://api.github.com/users/m-mizutani", 132 | "html_url": "https://github.com/m-mizutani", 133 | "followers_url": "https://api.github.com/users/m-mizutani/followers", 134 | "following_url": "https://api.github.com/users/m-mizutani/following{/other_user}", 135 | "gists_url": "https://api.github.com/users/m-mizutani/gists{/gist_id}", 136 | "starred_url": "https://api.github.com/users/m-mizutani/starred{/owner}{/repo}", 137 | "subscriptions_url": "https://api.github.com/users/m-mizutani/subscriptions", 138 | "organizations_url": "https://api.github.com/users/m-mizutani/orgs", 139 | "repos_url": "https://api.github.com/users/m-mizutani/repos", 140 | "events_url": "https://api.github.com/users/m-mizutani/events{/privacy}", 141 | "received_events_url": "https://api.github.com/users/m-mizutani/received_events", 142 | "type": "User", 143 | "site_admin": false 144 | }, 145 | "html_url": "https://github.com/m-mizutani/gh-audit-poc", 146 | "description": "GitHub continuous audit PoC", 147 | "fork": false, 148 | "url": "https://api.github.com/repos/m-mizutani/gh-audit-poc", 149 | "forks_url": "https://api.github.com/repos/m-mizutani/gh-audit-poc/forks", 150 | "keys_url": "https://api.github.com/repos/m-mizutani/gh-audit-poc/keys{/key_id}", 151 | "collaborators_url": "https://api.github.com/repos/m-mizutani/gh-audit-poc/collaborators{/collaborator}", 152 | "teams_url": "https://api.github.com/repos/m-mizutani/gh-audit-poc/teams", 153 | "hooks_url": "https://api.github.com/repos/m-mizutani/gh-audit-poc/hooks", 154 | "issue_events_url": "https://api.github.com/repos/m-mizutani/gh-audit-poc/issues/events{/number}", 155 | "events_url": "https://api.github.com/repos/m-mizutani/gh-audit-poc/events", 156 | "assignees_url": "https://api.github.com/repos/m-mizutani/gh-audit-poc/assignees{/user}", 157 | "branches_url": "https://api.github.com/repos/m-mizutani/gh-audit-poc/branches{/branch}", 158 | "tags_url": "https://api.github.com/repos/m-mizutani/gh-audit-poc/tags", 159 | "blobs_url": "https://api.github.com/repos/m-mizutani/gh-audit-poc/git/blobs{/sha}", 160 | "git_tags_url": "https://api.github.com/repos/m-mizutani/gh-audit-poc/git/tags{/sha}", 161 | "git_refs_url": "https://api.github.com/repos/m-mizutani/gh-audit-poc/git/refs{/sha}", 162 | "trees_url": "https://api.github.com/repos/m-mizutani/gh-audit-poc/git/trees{/sha}", 163 | "statuses_url": "https://api.github.com/repos/m-mizutani/gh-audit-poc/statuses/{sha}", 164 | "languages_url": "https://api.github.com/repos/m-mizutani/gh-audit-poc/languages", 165 | "stargazers_url": "https://api.github.com/repos/m-mizutani/gh-audit-poc/stargazers", 166 | "contributors_url": "https://api.github.com/repos/m-mizutani/gh-audit-poc/contributors", 167 | "subscribers_url": "https://api.github.com/repos/m-mizutani/gh-audit-poc/subscribers", 168 | "subscription_url": "https://api.github.com/repos/m-mizutani/gh-audit-poc/subscription", 169 | "commits_url": "https://api.github.com/repos/m-mizutani/gh-audit-poc/commits{/sha}", 170 | "git_commits_url": "https://api.github.com/repos/m-mizutani/gh-audit-poc/git/commits{/sha}", 171 | "comments_url": "https://api.github.com/repos/m-mizutani/gh-audit-poc/comments{/number}", 172 | "issue_comment_url": "https://api.github.com/repos/m-mizutani/gh-audit-poc/issues/comments{/number}", 173 | "contents_url": "https://api.github.com/repos/m-mizutani/gh-audit-poc/contents/{+path}", 174 | "compare_url": "https://api.github.com/repos/m-mizutani/gh-audit-poc/compare/{base}...{head}", 175 | "merges_url": "https://api.github.com/repos/m-mizutani/gh-audit-poc/merges", 176 | "archive_url": "https://api.github.com/repos/m-mizutani/gh-audit-poc/{archive_format}{/ref}", 177 | "downloads_url": "https://api.github.com/repos/m-mizutani/gh-audit-poc/downloads", 178 | "issues_url": "https://api.github.com/repos/m-mizutani/gh-audit-poc/issues{/number}", 179 | "pulls_url": "https://api.github.com/repos/m-mizutani/gh-audit-poc/pulls{/number}", 180 | "milestones_url": "https://api.github.com/repos/m-mizutani/gh-audit-poc/milestones{/number}", 181 | "notifications_url": "https://api.github.com/repos/m-mizutani/gh-audit-poc/notifications{?since,all,participating}", 182 | "labels_url": "https://api.github.com/repos/m-mizutani/gh-audit-poc/labels{/name}", 183 | "releases_url": "https://api.github.com/repos/m-mizutani/gh-audit-poc/releases{/id}", 184 | "deployments_url": "https://api.github.com/repos/m-mizutani/gh-audit-poc/deployments", 185 | "created_at": "2022-01-30T02:48:29Z", 186 | "updated_at": "2022-01-30T02:48:29Z", 187 | "pushed_at": "2022-01-30T03:26:54Z", 188 | "git_url": "git://github.com/m-mizutani/gh-audit-poc.git", 189 | "ssh_url": "git@github.com:m-mizutani/gh-audit-poc.git", 190 | "clone_url": "https://github.com/m-mizutani/gh-audit-poc.git", 191 | "svn_url": "https://github.com/m-mizutani/gh-audit-poc", 192 | "homepage": null, 193 | "size": 2, 194 | "stargazers_count": 0, 195 | "watchers_count": 0, 196 | "language": null, 197 | "has_issues": true, 198 | "has_projects": true, 199 | "has_downloads": true, 200 | "has_wiki": true, 201 | "has_pages": false, 202 | "forks_count": 0, 203 | "mirror_url": null, 204 | "archived": false, 205 | "disabled": false, 206 | "open_issues_count": 0, 207 | "license": null, 208 | "allow_forking": true, 209 | "is_template": false, 210 | "topics": [], 211 | "visibility": "public", 212 | "forks": 0, 213 | "open_issues": 0, 214 | "watchers": 0, 215 | "default_branch": "main" 216 | }, 217 | "sender": { 218 | "login": "m-mizutani", 219 | "id": 605953, 220 | "node_id": "MDQ6VXNlcjYwNTk1Mw==", 221 | "avatar_url": "https://avatars.githubusercontent.com/u/605953?v=4", 222 | "gravatar_id": "", 223 | "url": "https://api.github.com/users/m-mizutani", 224 | "html_url": "https://github.com/m-mizutani", 225 | "followers_url": "https://api.github.com/users/m-mizutani/followers", 226 | "following_url": "https://api.github.com/users/m-mizutani/following{/other_user}", 227 | "gists_url": "https://api.github.com/users/m-mizutani/gists{/gist_id}", 228 | "starred_url": "https://api.github.com/users/m-mizutani/starred{/owner}{/repo}", 229 | "subscriptions_url": "https://api.github.com/users/m-mizutani/subscriptions", 230 | "organizations_url": "https://api.github.com/users/m-mizutani/orgs", 231 | "repos_url": "https://api.github.com/users/m-mizutani/repos", 232 | "events_url": "https://api.github.com/users/m-mizutani/events{/privacy}", 233 | "received_events_url": "https://api.github.com/users/m-mizutani/received_events", 234 | "type": "User", 235 | "site_admin": false 236 | }, 237 | "installation": { 238 | "id": 23646876, 239 | "node_id": "MDIzOkludGVncmF0aW9uSW5zdGFsbGF0aW9uMjM2NDY4NzY=" 240 | } 241 | } 242 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | Apache License 2 | Version 2.0, January 2004 3 | http://www.apache.org/licenses/ 4 | 5 | TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 6 | 7 | 1. Definitions. 8 | 9 | "License" shall mean the terms and conditions for use, reproduction, 10 | and distribution as defined by Sections 1 through 9 of this document. 11 | 12 | "Licensor" shall mean the copyright owner or entity authorized by 13 | the copyright owner that is granting the License. 14 | 15 | "Legal Entity" shall mean the union of the acting entity and all 16 | other entities that control, are controlled by, or are under common 17 | control with that entity. For the purposes of this definition, 18 | "control" means (i) the power, direct or indirect, to cause the 19 | direction or management of such entity, whether by contract or 20 | otherwise, or (ii) ownership of fifty percent (50%) or more of the 21 | outstanding shares, or (iii) beneficial ownership of such entity. 22 | 23 | "You" (or "Your") shall mean an individual or Legal Entity 24 | exercising permissions granted by this License. 25 | 26 | "Source" form shall mean the preferred form for making modifications, 27 | including but not limited to software source code, documentation 28 | source, and configuration files. 29 | 30 | "Object" form shall mean any form resulting from mechanical 31 | transformation or translation of a Source form, including but 32 | not limited to compiled object code, generated documentation, 33 | and conversions to other media types. 34 | 35 | "Work" shall mean the work of authorship, whether in Source or 36 | Object form, made available under the License, as indicated by a 37 | copyright notice that is included in or attached to the work 38 | (an example is provided in the Appendix below). 39 | 40 | "Derivative Works" shall mean any work, whether in Source or Object 41 | form, that is based on (or derived from) the Work and for which the 42 | editorial revisions, annotations, elaborations, or other modifications 43 | represent, as a whole, an original work of authorship. For the purposes 44 | of this License, Derivative Works shall not include works that remain 45 | separable from, or merely link (or bind by name) to the interfaces of, 46 | the Work and Derivative Works thereof. 47 | 48 | "Contribution" shall mean any work of authorship, including 49 | the original version of the Work and any modifications or additions 50 | to that Work or Derivative Works thereof, that is intentionally 51 | submitted to Licensor for inclusion in the Work by the copyright owner 52 | or by an individual or Legal Entity authorized to submit on behalf of 53 | the copyright owner. For the purposes of this definition, "submitted" 54 | means any form of electronic, verbal, or written communication sent 55 | to the Licensor or its representatives, including but not limited to 56 | communication on electronic mailing lists, source code control systems, 57 | and issue tracking systems that are managed by, or on behalf of, the 58 | Licensor for the purpose of discussing and improving the Work, but 59 | excluding communication that is conspicuously marked or otherwise 60 | designated in writing by the copyright owner as "Not a Contribution." 61 | 62 | "Contributor" shall mean Licensor and any individual or Legal Entity 63 | on behalf of whom a Contribution has been received by Licensor and 64 | subsequently incorporated within the Work. 65 | 66 | 2. Grant of Copyright License. Subject to the terms and conditions of 67 | this License, each Contributor hereby grants to You a perpetual, 68 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 69 | copyright license to reproduce, prepare Derivative Works of, 70 | publicly display, publicly perform, sublicense, and distribute the 71 | Work and such Derivative Works in Source or Object form. 72 | 73 | 3. Grant of Patent License. Subject to the terms and conditions of 74 | this License, each Contributor hereby grants to You a perpetual, 75 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 76 | (except as stated in this section) patent license to make, have made, 77 | use, offer to sell, sell, import, and otherwise transfer the Work, 78 | where such license applies only to those patent claims licensable 79 | by such Contributor that are necessarily infringed by their 80 | Contribution(s) alone or by combination of their Contribution(s) 81 | with the Work to which such Contribution(s) was submitted. If You 82 | institute patent litigation against any entity (including a 83 | cross-claim or counterclaim in a lawsuit) alleging that the Work 84 | or a Contribution incorporated within the Work constitutes direct 85 | or contributory patent infringement, then any patent licenses 86 | granted to You under this License for that Work shall terminate 87 | as of the date such litigation is filed. 88 | 89 | 4. Redistribution. You may reproduce and distribute copies of the 90 | Work or Derivative Works thereof in any medium, with or without 91 | modifications, and in Source or Object form, provided that You 92 | meet the following conditions: 93 | 94 | (a) You must give any other recipients of the Work or 95 | Derivative Works a copy of this License; and 96 | 97 | (b) You must cause any modified files to carry prominent notices 98 | stating that You changed the files; and 99 | 100 | (c) You must retain, in the Source form of any Derivative Works 101 | that You distribute, all copyright, patent, trademark, and 102 | attribution notices from the Source form of the Work, 103 | excluding those notices that do not pertain to any part of 104 | the Derivative Works; and 105 | 106 | (d) If the Work includes a "NOTICE" text file as part of its 107 | distribution, then any Derivative Works that You distribute must 108 | include a readable copy of the attribution notices contained 109 | within such NOTICE file, excluding those notices that do not 110 | pertain to any part of the Derivative Works, in at least one 111 | of the following places: within a NOTICE text file distributed 112 | as part of the Derivative Works; within the Source form or 113 | documentation, if provided along with the Derivative Works; or, 114 | within a display generated by the Derivative Works, if and 115 | wherever such third-party notices normally appear. The contents 116 | of the NOTICE file are for informational purposes only and 117 | do not modify the License. You may add Your own attribution 118 | notices within Derivative Works that You distribute, alongside 119 | or as an addendum to the NOTICE text from the Work, provided 120 | that such additional attribution notices cannot be construed 121 | as modifying the License. 122 | 123 | You may add Your own copyright statement to Your modifications and 124 | may provide additional or different license terms and conditions 125 | for use, reproduction, or distribution of Your modifications, or 126 | for any such Derivative Works as a whole, provided Your use, 127 | reproduction, and distribution of the Work otherwise complies with 128 | the conditions stated in this License. 129 | 130 | 5. Submission of Contributions. Unless You explicitly state otherwise, 131 | any Contribution intentionally submitted for inclusion in the Work 132 | by You to the Licensor shall be under the terms and conditions of 133 | this License, without any additional terms or conditions. 134 | Notwithstanding the above, nothing herein shall supersede or modify 135 | the terms of any separate license agreement you may have executed 136 | with Licensor regarding such Contributions. 137 | 138 | 6. Trademarks. This License does not grant permission to use the trade 139 | names, trademarks, service marks, or product names of the Licensor, 140 | except as required for reasonable and customary use in describing the 141 | origin of the Work and reproducing the content of the NOTICE file. 142 | 143 | 7. Disclaimer of Warranty. Unless required by applicable law or 144 | agreed to in writing, Licensor provides the Work (and each 145 | Contributor provides its Contributions) on an "AS IS" BASIS, 146 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 147 | implied, including, without limitation, any warranties or conditions 148 | of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A 149 | PARTICULAR PURPOSE. You are solely responsible for determining the 150 | appropriateness of using or redistributing the Work and assume any 151 | risks associated with Your exercise of permissions under this License. 152 | 153 | 8. Limitation of Liability. In no event and under no legal theory, 154 | whether in tort (including negligence), contract, or otherwise, 155 | unless required by applicable law (such as deliberate and grossly 156 | negligent acts) or agreed to in writing, shall any Contributor be 157 | liable to You for damages, including any direct, indirect, special, 158 | incidental, or consequential damages of any character arising as a 159 | result of this License or out of the use or inability to use the 160 | Work (including but not limited to damages for loss of goodwill, 161 | work stoppage, computer failure or malfunction, or any and all 162 | other commercial damages or losses), even if such Contributor 163 | has been advised of the possibility of such damages. 164 | 165 | 9. Accepting Warranty or Additional Liability. While redistributing 166 | the Work or Derivative Works thereof, You may choose to offer, 167 | and charge a fee for, acceptance of support, warranty, indemnity, 168 | or other liability obligations and/or rights consistent with this 169 | License. However, in accepting such obligations, You may act only 170 | on Your own behalf and on Your sole responsibility, not on behalf 171 | of any other Contributor, and only if You agree to indemnify, 172 | defend, and hold each Contributor harmless for any liability 173 | incurred by, or claims asserted against, such Contributor by reason 174 | of your accepting any such warranty or additional liability. 175 | 176 | END OF TERMS AND CONDITIONS 177 | 178 | APPENDIX: How to apply the Apache License to your work. 179 | 180 | To apply the Apache License to your work, attach the following 181 | boilerplate notice, with the fields enclosed by brackets "[]" 182 | replaced with your own identifying information. (Don't include 183 | the brackets!) The text should be enclosed in the appropriate 184 | comment syntax for the file format. We also recommend that a 185 | file or class name and description of purpose be included on the 186 | same "printed page" as the copyright notice for easier 187 | identification within third-party archives. 188 | 189 | Copyright [yyyy] [name of copyright owner] 190 | 191 | Licensed under the Apache License, Version 2.0 (the "License"); 192 | you may not use this file except in compliance with the License. 193 | You may obtain a copy of the License at 194 | 195 | http://www.apache.org/licenses/LICENSE-2.0 196 | 197 | Unless required by applicable law or agreed to in writing, software 198 | distributed under the License is distributed on an "AS IS" BASIS, 199 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 200 | See the License for the specific language governing permissions and 201 | limitations under the License. 202 | -------------------------------------------------------------------------------- /go.sum: -------------------------------------------------------------------------------- 1 | cloud.google.com/go v0.26.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= 2 | cloud.google.com/go v0.34.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= 3 | cloud.google.com/go/compute v1.20.1 h1:6aKEtlUiwEpJzM001l0yFkpXmUVXaN8W+fbkb2AZNbg= 4 | cloud.google.com/go/compute v1.20.1/go.mod h1:4tCnrn48xsqlwSAiLf1HXMQk8CONslYbdiEZc9FEIbM= 5 | cloud.google.com/go/compute/metadata v0.2.3 h1:mg4jlk7mCAj6xXp9UJ4fjI9VUI5rubuGBW5aJ7UnBMY= 6 | cloud.google.com/go/compute/metadata v0.2.3/go.mod h1:VAV5nSsACxMJvgaAuX6Pk2AawlZn8kiOGuCv6gTkwuA= 7 | github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU= 8 | github.com/OneOfOne/xxhash v1.2.8 h1:31czK/TI9sNkxIKfaUfGlU47BAxQ0ztGgd9vPyqimf8= 9 | github.com/OneOfOne/xxhash v1.2.8/go.mod h1:eZbhyaAYD41SGSSsnmcpxVoRiQ/MPUTjUdIIOT9Um7Q= 10 | github.com/agnivade/levenshtein v1.1.1 h1:QY8M92nrzkmr798gCo3kmMyqXFzdQVpxLlGPRBij0P8= 11 | github.com/agnivade/levenshtein v1.1.1/go.mod h1:veldBMzWxcCG2ZvUTKD2kJNRdCk5hVbJomOvKkmgYbo= 12 | github.com/antihax/optional v1.0.0/go.mod h1:uupD/76wgC+ih3iEmQUL+0Ugr19nfwCT1kdvxnR2qWY= 13 | github.com/arbovm/levenshtein v0.0.0-20160628152529-48b4e1c0c4d0 h1:jfIu9sQUG6Ig+0+Ap1h4unLjW6YQJpKZVmUzxsD4E/Q= 14 | github.com/arbovm/levenshtein v0.0.0-20160628152529-48b4e1c0c4d0/go.mod h1:t2tdKJDJF9BV14lnkjHmOQgcvEKgtqs5a1N3LNdJhGE= 15 | github.com/asaskevich/govalidator v0.0.0-20200108200545-475eaeb16496/go.mod h1:oGkLhpf+kjZl6xBf758TQhh5XrAeiJv/7FRz/2spLIg= 16 | github.com/asaskevich/govalidator v0.0.0-20230301143203-a9d515a09cc2 h1:DklsrG3dyBCFEj5IhUbnKptjxatkF07cF2ak3yi77so= 17 | github.com/asaskevich/govalidator v0.0.0-20230301143203-a9d515a09cc2/go.mod h1:WaHUgvxTVq04UNunO+XhnAqY/wQc+bxr74GqbsZ/Jqw= 18 | github.com/beorn7/perks v1.0.1 h1:VlbKKnNfV8bJzeqoa4cOKqO6bYr3WgKZxO8Z16+hsOM= 19 | github.com/bytecodealliance/wasmtime-go/v3 v3.0.2 h1:3uZCA/BLTIu+DqCfguByNMJa2HVHpXvjfy0Dy7g6fuA= 20 | github.com/census-instrumentation/opencensus-proto v0.2.1/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU= 21 | github.com/cespare/xxhash v1.1.0 h1:a6HrQnmkObjyL+Gs60czilIUGqrzKutQD6XZog3p+ko= 22 | github.com/cespare/xxhash/v2 v2.1.1/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs= 23 | github.com/cespare/xxhash/v2 v2.2.0 h1:DC2CZ1Ep5Y4k3ZQ899DldepgrayRUGE6BBZ/cd9Cj44= 24 | github.com/client9/misspell v0.3.4/go.mod h1:qj6jICC3Q7zFZvVWo7KLAzC3yx5G7kyvSDkc90ppPyw= 25 | github.com/cncf/udpa/go v0.0.0-20191209042840-269d4d468f6f/go.mod h1:M8M6+tZqaGXZJjfX53e64911xZQV5JYwmTeXPW+k8Sc= 26 | github.com/cncf/udpa/go v0.0.0-20201120205902-5459f2c99403/go.mod h1:WmhPx2Nbnhtbo57+VJT5O0JRkEi1Wbu0z5j0R8u5Hbk= 27 | github.com/cncf/udpa/go v0.0.0-20210930031921-04548b0d99d4/go.mod h1:6pvJx4me5XPnfI9Z40ddWsdw2W/uZgQLFXToKeRcDiI= 28 | github.com/cncf/xds/go v0.0.0-20210805033703-aa0b78936158/go.mod h1:eXthEFrGJvWHgFFCl3hGmgk+/aYT6PnTQLykKQRLhEs= 29 | github.com/cncf/xds/go v0.0.0-20210922020428-25de7278fc84/go.mod h1:eXthEFrGJvWHgFFCl3hGmgk+/aYT6PnTQLykKQRLhEs= 30 | github.com/cncf/xds/go v0.0.0-20211011173535-cb28da3451f1/go.mod h1:eXthEFrGJvWHgFFCl3hGmgk+/aYT6PnTQLykKQRLhEs= 31 | github.com/cpuguy83/go-md2man/v2 v2.0.2 h1:p1EgwI/C7NhT0JmVkwCD2ZBK8j4aeHQX2pMHHBfMQ6w= 32 | github.com/cpuguy83/go-md2man/v2 v2.0.2/go.mod h1:tgQtvFlXSQOSOSIRvRPT7W67SCa46tRHOmNcaadrF8o= 33 | github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= 34 | github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= 35 | github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= 36 | github.com/dgraph-io/badger/v3 v3.2103.5 h1:ylPa6qzbjYRQMU6jokoj4wzcaweHylt//CH0AKt0akg= 37 | github.com/dgraph-io/ristretto v0.1.1 h1:6CWw5tJNgpegArSHpNHJKldNeq03FQCwYvfMVWajOK8= 38 | github.com/dgryski/trifles v0.0.0-20200323201526-dd97f9abfb48 h1:fRzb/w+pyskVMQ+UbP35JkH8yB7MYb4q/qhBarqZE6g= 39 | github.com/dgryski/trifles v0.0.0-20200323201526-dd97f9abfb48/go.mod h1:if7Fbed8SFyPtHLHbg49SI7NAdJiC5WIA09pe59rfAA= 40 | github.com/dustin/go-humanize v1.0.0 h1:VSnTsYCnlFHaM2/igO1h6X3HA71jcobQuxemgkq4zYo= 41 | github.com/envoyproxy/go-control-plane v0.9.0/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4= 42 | github.com/envoyproxy/go-control-plane v0.9.1-0.20191026205805-5f8ba28d4473/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4= 43 | github.com/envoyproxy/go-control-plane v0.9.4/go.mod h1:6rpuAdCZL397s3pYoYcLgu1mIlRU8Am5FuJP05cCM98= 44 | github.com/envoyproxy/go-control-plane v0.9.9-0.20201210154907-fd9021fe5dad/go.mod h1:cXg6YxExXjJnVBQHBLXeUAgxn2UodCpnH306RInaBQk= 45 | github.com/envoyproxy/go-control-plane v0.9.10-0.20210907150352-cf90f659a021/go.mod h1:AFq3mo9L8Lqqiid3OhADV3RfLJnjiw63cSpi+fDTRC0= 46 | github.com/envoyproxy/protoc-gen-validate v0.1.0/go.mod h1:iSmxcyjqTsJpI2R4NaDN7+kN2VEUnK/pcBlmesArF7c= 47 | github.com/fatih/color v1.15.0 h1:kOqh6YHBtK8aywxGerMG2Eq3H6Qgoqeo13Bk2Mv/nBs= 48 | github.com/fatih/color v1.15.0/go.mod h1:0h5ZqXfHYED7Bhv2ZJamyIOUej9KtShiJESRwBDUSsw= 49 | github.com/fortytw2/leaktest v1.3.0 h1:u8491cBMTQ8ft8aeV+adlcytMZylmA5nnwwkRZjI8vw= 50 | github.com/foxcpp/go-mockdns v1.0.0 h1:7jBqxd3WDWwi/6WhDvacvH1XsN3rOLXyHM1uhvIx6FI= 51 | github.com/ghodss/yaml v1.0.0 h1:wQHKEahhL6wmXdzwWG11gIVCkOv05bNOh+Rxn0yngAk= 52 | github.com/ghodss/yaml v1.0.0/go.mod h1:4dBDuWmgqj2HViK6kFavaiC9ZROes6MMH2rRYeMEF04= 53 | github.com/go-chi/chi v1.5.4 h1:QHdzF2szwjqVV4wmByUnTcsbIg7UGaQ0tPF2t5GcAIs= 54 | github.com/go-chi/chi v1.5.4/go.mod h1:uaf8YgoFazUOkPBG7fxPftUylNumIev9awIWOENIuEg= 55 | github.com/go-ozzo/ozzo-validation/v4 v4.3.0 h1:byhDUpfEwjsVQb1vBunvIjh2BHQ9ead57VkAEY4V+Es= 56 | github.com/go-ozzo/ozzo-validation/v4 v4.3.0/go.mod h1:2NKgrcHl3z6cJs+3Oo940FPRiTzuqKbvfrL2RxCj6Ew= 57 | github.com/go-test/deep v1.0.4 h1:u2CU3YKy9I2pmu9pX0eq50wCgjfGIt539SqR7FbHiho= 58 | github.com/go-test/deep v1.0.4/go.mod h1:wGDj63lr65AM2AQyKZd/NYHGb0R+1RLqB8NKt3aSFNA= 59 | github.com/gobwas/glob v0.2.3 h1:A4xDbljILXROh+kObIiy5kIaPYD8e96x1tgBhUI5J+Y= 60 | github.com/gobwas/glob v0.2.3/go.mod h1:d3Ez4x06l9bZtSvzIay5+Yzi0fmZzPgnTbPcKjJAkT8= 61 | github.com/gogo/protobuf v1.3.2 h1:Ov1cvc58UF3b5XjBnZv7+opcTcQFZebYjWzi34vdm4Q= 62 | github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b/go.mod h1:SBH7ygxi8pfUlaOkMMuAQtPIUF8ecWP5IEl/CR7VP2Q= 63 | github.com/golang/glog v1.1.0 h1:/d3pCKDPWNnvIWe0vVUpNP32qc8U3PDVxySP/y360qE= 64 | github.com/golang/groupcache v0.0.0-20200121045136-8c9f03a8e57e/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= 65 | github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da h1:oI5xCqsCo564l8iNU+DwB5epxmsaqB+rhGL0m5jtYqE= 66 | github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= 67 | github.com/golang/mock v1.1.1/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfbm0A= 68 | github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= 69 | github.com/golang/protobuf v1.3.1/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= 70 | github.com/golang/protobuf v1.3.2/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= 71 | github.com/golang/protobuf v1.3.3/go.mod h1:vzj43D7+SQXF/4pzW/hwtAqwc6iTitCiVSaWz5lYuqw= 72 | github.com/golang/protobuf v1.4.0-rc.1/go.mod h1:ceaxUfeHdC40wWswd/P6IGgMaK3YpKi5j83Wpe3EHw8= 73 | github.com/golang/protobuf v1.4.0-rc.1.0.20200221234624-67d41d38c208/go.mod h1:xKAWHe0F5eneWXFV3EuXVDTCmh+JuBKY0li0aMyXATA= 74 | github.com/golang/protobuf v1.4.0-rc.2/go.mod h1:LlEzMj4AhA7rCAGe4KMBDvJI+AwstrUpVNzEA03Pprs= 75 | github.com/golang/protobuf v1.4.0-rc.4.0.20200313231945-b860323f09d0/go.mod h1:WU3c8KckQ9AFe+yFwt9sWVRKCVIyN9cPHBJSNnbL67w= 76 | github.com/golang/protobuf v1.4.0/go.mod h1:jodUvKwWbYaEsadDk5Fwe5c77LiNKVO9IDvqG2KuDX0= 77 | github.com/golang/protobuf v1.4.1/go.mod h1:U8fpvMrcmy5pZrNK1lt4xCsGvpyWQ/VVv6QDs8UjoX8= 78 | github.com/golang/protobuf v1.4.2/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw735rRwI= 79 | github.com/golang/protobuf v1.4.3/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw735rRwI= 80 | github.com/golang/protobuf v1.5.0/go.mod h1:FsONVRAS9T7sI+LIUmWTfcYkHO4aIWwzhcaSAoJOfIk= 81 | github.com/golang/protobuf v1.5.2/go.mod h1:XVQd3VNwM+JqD3oG2Ue2ip4fOMUkwXdXDdiuN0vRsmY= 82 | github.com/golang/protobuf v1.5.3 h1:KhyjKVUg7Usr/dYsdSqoFveMYd5ko72D+zANwlG1mmg= 83 | github.com/golang/protobuf v1.5.3/go.mod h1:XVQd3VNwM+JqD3oG2Ue2ip4fOMUkwXdXDdiuN0vRsmY= 84 | github.com/golang/snappy v0.0.4 h1:yAGX7huGHXlcLOEtBnF4w7FQwA26wojNCwOYAEhLjQM= 85 | github.com/google/flatbuffers v1.12.1 h1:MVlul7pQNoDzWRLTw5imwYsl+usrS1TXG2H4jg6ImGw= 86 | github.com/google/go-cmp v0.2.0/go.mod h1:oXzfMopK8JAjlY9xF4vHSVASa0yLyX7SntLO5aqRK0M= 87 | github.com/google/go-cmp v0.3.0/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= 88 | github.com/google/go-cmp v0.3.1/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= 89 | github.com/google/go-cmp v0.4.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= 90 | github.com/google/go-cmp v0.5.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= 91 | github.com/google/go-cmp v0.5.2/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= 92 | github.com/google/go-cmp v0.5.3/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= 93 | github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= 94 | github.com/google/go-cmp v0.5.7/go.mod h1:n+brtR0CgQNWTVd5ZUFpTBC8YFBDLK/h/bpaJ8/DtOE= 95 | github.com/google/go-cmp v0.5.9 h1:O2Tfq5qg4qc4AmwVlvv0oLiVAGB7enBSJ2x2DqQFi38= 96 | github.com/google/go-github/v43 v43.0.0 h1:y+GL7LIsAIF2NZlJ46ZoC/D1W1ivZasT0lnWHMYPZ+U= 97 | github.com/google/go-github/v43 v43.0.0/go.mod h1:ZkTvvmCXBvsfPpTHXnH/d2hP9Y0cTbvN9kr5xqyXOIc= 98 | github.com/google/go-querystring v1.1.0 h1:AnCroh3fv4ZBgVIf1Iwtovgjaw/GiKJo8M8yD/fhyJ8= 99 | github.com/google/go-querystring v1.1.0/go.mod h1:Kcdr2DB4koayq7X8pmAG4sNG59So17icRSOU623lUBU= 100 | github.com/google/s2a-go v0.1.4 h1:1kZ/sQM3srePvKs3tXAvQzo66XfcReoqFpIpIccE7Oc= 101 | github.com/google/s2a-go v0.1.4/go.mod h1:Ej+mSEMGRnqRzjc7VtF+jdBwYG5fuJfiZ8ELkjEwM0A= 102 | github.com/google/uuid v1.1.2/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= 103 | github.com/google/uuid v1.3.0 h1:t6JiXgmwXMjEs8VusXIJk2BXHsn+wx8BZdTaoZ5fu7I= 104 | github.com/google/uuid v1.3.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= 105 | github.com/googleapis/enterprise-certificate-proxy v0.2.5 h1:UR4rDjcgpgEnqpIEvkiqTYKBCKLNmlge2eVjoZfySzM= 106 | github.com/googleapis/enterprise-certificate-proxy v0.2.5/go.mod h1:RxW0N9901Cko1VOCW3SXCpWP+mlIEkk2tP7jnHy9a3w= 107 | github.com/googleapis/gax-go/v2 v2.11.0 h1:9V9PWXEsWnPpQhu/PeQIkS4eGzMlTLGgt80cUUI8Ki4= 108 | github.com/gorilla/websocket v1.4.2/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/adAjf1fMHhE= 109 | github.com/gorilla/websocket v1.5.0 h1:PPwGk2jz7EePpoHN/+ClbZu8SPxiqlu12wZP/3sWmnc= 110 | github.com/gorilla/websocket v1.5.0/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/adAjf1fMHhE= 111 | github.com/grpc-ecosystem/grpc-gateway v1.16.0/go.mod h1:BDjrQk3hbvj6Nolgz8mAMFbcEtjT1g+wF4CSlocrBnw= 112 | github.com/k0kubun/colorstring v0.0.0-20150214042306-9440f1994b88 h1:uC1QfSlInpQF+M0ao65imhwqKnz3Q2z/d8PWZRMQvDM= 113 | github.com/k0kubun/colorstring v0.0.0-20150214042306-9440f1994b88/go.mod h1:3w7q1U84EfirKl04SVQ/s7nPm1ZPhiXd34z40TNz36k= 114 | github.com/k0kubun/pp/v3 v3.2.0 h1:h33hNTZ9nVFNP3u2Fsgz8JXiF5JINoZfFq4SvKJwNcs= 115 | github.com/k0kubun/pp/v3 v3.2.0/go.mod h1:ODtJQbQcIRfAD3N+theGCV1m/CBxweERz2dapdz1EwA= 116 | github.com/klauspost/compress v1.13.6 h1:P76CopJELS0TiO2mebmnzgWaajssP/EszplttgQxcgc= 117 | github.com/kr/pretty v0.3.1 h1:flRD4NNwYAUpkphVc1HcthR4KEIFJ65n8Mw5qdRn3LE= 118 | github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY= 119 | github.com/m-mizutani/alertchain v0.0.6 h1:UWy1cGNXuoHhBYc8mlrdv/VT4GcBUAwrW5yehaB+jgE= 120 | github.com/m-mizutani/alertchain v0.0.6/go.mod h1:1w9OITvc2x2j6x7HuxSFvAYLHKKTE6rlWqIJOLVIXP0= 121 | github.com/m-mizutani/clog v0.0.2 h1:SrvYkuqX8W8NzAg+bcYF0BK/0ykHb2QXaTfAJSScGrc= 122 | github.com/m-mizutani/clog v0.0.2/go.mod h1:Nl4E4DJxrlovZd82GtAGIlIRJ4+oSbXCtVMgT0d0Nwo= 123 | github.com/m-mizutani/goerr v0.1.8 h1:6UtsMmOkJsaYNtAsMNLvWIteZPl1NOxpKFYK5m65vpQ= 124 | github.com/m-mizutani/goerr v0.1.8/go.mod h1:fQkXuu06q+oLlp4FkbiTFzI/N/+WAK/Mz1W5kPZ6yzs= 125 | github.com/m-mizutani/gt v0.0.5 h1:mnFJDOfNe5adq2zOxhN1MABX9euu/+086xMRKG/oDgc= 126 | github.com/m-mizutani/masq v0.1.1 h1:Q+MD2N6vSevQGIF71JE3fhqc4tENtCogcdWCUyyYAEA= 127 | github.com/m-mizutani/masq v0.1.1/go.mod h1:0DMb1XrlQcNONMWTgm3VnLQ3cqobspVI7f8kQJ2qb+M= 128 | github.com/m-mizutani/opac v0.1.2 h1:k1MWjwPCxFW0lAGKHaWS9mmYYz6aNTGft6spN4czOkc= 129 | github.com/m-mizutani/opac v0.1.2/go.mod h1:l3VzU3/V2jJ7Fiu7f1I7NdVBodhsa4IIv3SqWrd+kY0= 130 | github.com/m-mizutani/zlog v0.3.4 h1:uI3SGLILZmeGfKstWlCY0CHLYsaLe7/h9+eJH+aF7qs= 131 | github.com/m-mizutani/zlog v0.3.4/go.mod h1:UCfQqU0JTe0pdWGxvO4RL8YOkejUKIpj9kh+9oLUkpA= 132 | github.com/mattn/go-colorable v0.1.13 h1:fFA4WZxdEF4tXPZVKMLwD8oUnCTTo08duU7wxecdEvA= 133 | github.com/mattn/go-colorable v0.1.13/go.mod h1:7S9/ev0klgBDR4GtXTXX8a3vIGJpMovkB8vQcUbaXHg= 134 | github.com/mattn/go-isatty v0.0.16/go.mod h1:kYGgaQfpe5nmfYZH+SKPsOc2e4SrIfOl2e/yFXSvRLM= 135 | github.com/mattn/go-isatty v0.0.19 h1:JITubQf0MOLdlGRuRq+jtsDlekdYPia9ZFsB8h/APPA= 136 | github.com/mattn/go-isatty v0.0.19/go.mod h1:W+V8PltTTMOvKvAeJH7IuucS94S2C6jfK/D7dTCTo3Y= 137 | github.com/matttproud/golang_protobuf_extensions v1.0.4 h1:mmDVorXM7PCGKw94cs5zkfA9PSy5pEvNWRP0ET0TIVo= 138 | github.com/miekg/dns v1.1.43 h1:JKfpVSCB84vrAmHzyrsxB5NAr5kLoMXZArPSw7Qlgyg= 139 | github.com/open-policy-agent/opa v0.52.0 h1:Rv3F+VCDqsufaiYy/3S9/Iuk0yfcREK4iZmWbNsKZjA= 140 | github.com/open-policy-agent/opa v0.52.0/go.mod h1:2n99s7WY/BXZUWUOq10JdTgK+G6XM4FYGoe7kQ5Vg0s= 141 | github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4= 142 | github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= 143 | github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= 144 | github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= 145 | github.com/prometheus/client_golang v1.16.0 h1:yk/hx9hDbrGHovbci4BY+pRMfSuuat626eFsHb7tmT8= 146 | github.com/prometheus/client_golang v1.16.0/go.mod h1:Zsulrv/L9oM40tJ7T815tM89lFEugiJ9HzIqaAx4LKc= 147 | github.com/prometheus/client_model v0.0.0-20190812154241-14fe0d1b01d4/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= 148 | github.com/prometheus/client_model v0.4.0 h1:5lQXD3cAg1OXBf4Wq03gTrXHeaV0TQvGfUooCfx1yqY= 149 | github.com/prometheus/client_model v0.4.0/go.mod h1:oMQmHW1/JoDwqLtg57MGgP/Fb1CJEYF2imWWhWtMkYU= 150 | github.com/prometheus/common v0.44.0 h1:+5BrQJwiBB9xsMygAB3TNvpQKOwlkc25LbISbrdOOfY= 151 | github.com/prometheus/common v0.44.0/go.mod h1:ofAIvZbQ1e/nugmZGz4/qCb9Ap1VoSTIO7x0VV9VvuY= 152 | github.com/prometheus/procfs v0.11.0 h1:5EAgkfkMl659uZPbe9AS2N68a7Cc1TJbPEuGzFuRbyk= 153 | github.com/prometheus/procfs v0.11.0/go.mod h1:nwNm2aOCAYw8uTR/9bWRREkZFxAUcWzPHWJq+XBB/FM= 154 | github.com/rcrowley/go-metrics v0.0.0-20201227073835-cf1acfcdf475 h1:N/ElC8H3+5XpJzTSTfLsJV/mx9Q9g7kxmchpfZyxgzM= 155 | github.com/rcrowley/go-metrics v0.0.0-20201227073835-cf1acfcdf475/go.mod h1:bCqnVzQkZxMG4s8nGwiZ5l3QUCyqpo9Y+/ZMZ9VjZe4= 156 | github.com/rogpeppe/fastuuid v1.2.0/go.mod h1:jVj6XXZzXRy/MSR5jhDC/2q6DgLz+nrA6LYCDYWNEvQ= 157 | github.com/rogpeppe/go-internal v1.10.0 h1:TMyTOH3F/DB16zRVcYyreMH6GnZZrwQVAoYjRBZyWFQ= 158 | github.com/rogpeppe/go-internal v1.10.0/go.mod h1:UQnix2H7Ngw/k4C5ijL5+65zddjncjaFoBhdsK/akog= 159 | github.com/russross/blackfriday/v2 v2.1.0 h1:JIOH55/0cWyOuilr9/qlrm0BSXldqnqwMsf35Ld67mk= 160 | github.com/russross/blackfriday/v2 v2.1.0/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM= 161 | github.com/sirupsen/logrus v1.9.3 h1:dueUQJ1C2q9oE3F7wvmSGAaVtTmUizReu6fjN8uqzbQ= 162 | github.com/sirupsen/logrus v1.9.3/go.mod h1:naHLuLoDiP4jHNo9R0sCBMtWGeIprob74mVsIT4qYEQ= 163 | github.com/slack-go/slack v0.12.2 h1:x3OppyMyGIbbiyFhsBmpf9pwkUzMhthJMRNmNlA4LaQ= 164 | github.com/slack-go/slack v0.12.2/go.mod h1:hlGi5oXA+Gt+yWTPP0plCdRKmjsDxecdHxYQdlMQKOw= 165 | github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= 166 | github.com/stretchr/objx v0.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSSt89Yw= 167 | github.com/stretchr/objx v0.5.0/go.mod h1:Yh+to48EsGEfYuaHDzXPcE3xhTkx73EhmCGUpEOglKo= 168 | github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs= 169 | github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4= 170 | github.com/stretchr/testify v1.5.1/go.mod h1:5W2xD1RspED5o8YsWQXVCued0rvSQ+mT+I5cxcmMvtA= 171 | github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= 172 | github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= 173 | github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU= 174 | github.com/stretchr/testify v1.8.1/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4= 175 | github.com/stretchr/testify v1.8.3 h1:RP3t2pwF7cMEbC1dqtB6poj3niw/9gnV4Cjg5oW5gtY= 176 | github.com/stretchr/testify v1.8.3/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo= 177 | github.com/tchap/go-patricia/v2 v2.3.1 h1:6rQp39lgIYZ+MHmdEq4xzuk1t7OdC35z/xm0BGhTkes= 178 | github.com/tchap/go-patricia/v2 v2.3.1/go.mod h1:VZRHKAb53DLaG+nA9EaYYiaEx6YztwDlLElMsnSHD4k= 179 | github.com/urfave/cli/v2 v2.25.7 h1:VAzn5oq403l5pHjc4OhD54+XGO9cdKVL/7lDjF+iKUs= 180 | github.com/urfave/cli/v2 v2.25.7/go.mod h1:8qnjx1vcq5s2/wpsqoZFndg2CE5tNFyrTvS6SinrnYQ= 181 | github.com/xeipuuv/gojsonpointer v0.0.0-20190905194746-02993c407bfb h1:zGWFAtiMcyryUHoUjUJX0/lt1H2+i2Ka2n+D3DImSNo= 182 | github.com/xeipuuv/gojsonpointer v0.0.0-20190905194746-02993c407bfb/go.mod h1:N2zxlSyiKSe5eX1tZViRH5QA0qijqEDrYZiPEAiq3wU= 183 | github.com/xeipuuv/gojsonreference v0.0.0-20180127040603-bd5ef7bd5415 h1:EzJWgHovont7NscjpAxXsDA8S8BMYve8Y5+7cuRE7R0= 184 | github.com/xeipuuv/gojsonreference v0.0.0-20180127040603-bd5ef7bd5415/go.mod h1:GwrjFmJcFw6At/Gs6z4yjiIwzuJ1/+UwLxMQDVQXShQ= 185 | github.com/xrash/smetrics v0.0.0-20201216005158-039620a65673 h1:bAn7/zixMGCfxrRTfdpNzjtPYqr8smhKouy9mxVdGPU= 186 | github.com/xrash/smetrics v0.0.0-20201216005158-039620a65673/go.mod h1:N3UwUGtsrSj3ccvlPHLoLsHnpR27oXr4ZE984MbSER8= 187 | github.com/yashtewari/glob-intersection v0.2.0 h1:8iuHdN88yYuCzCdjt0gDe+6bAhUwBeEWqThExu54RFg= 188 | github.com/yashtewari/glob-intersection v0.2.0/go.mod h1:LK7pIC3piUjovexikBbJ26Yml7g8xa5bsjfx2v1fwok= 189 | github.com/yuin/goldmark v1.4.13/go.mod h1:6yULJ656Px+3vBD8DxQVa3kxgyrAnzto9xy5taEt/CY= 190 | go.opencensus.io v0.24.0 h1:y73uSU6J157QMP2kn2r30vwW1A2W2WFwSCGnAVxeaD0= 191 | go.opencensus.io v0.24.0/go.mod h1:vNK8G9p7aAivkbmorf4v+7Hgx+Zs0yY+0fOtgBfjQKo= 192 | go.opentelemetry.io/proto/otlp v0.7.0/go.mod h1:PqfVotwruBrMGOCsRd/89rSnXhoiJIqeYNgFYFoEGnI= 193 | golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= 194 | golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= 195 | golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= 196 | golang.org/x/crypto v0.0.0-20220314234659-1baeb1ce4c0b/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4= 197 | golang.org/x/crypto v0.31.0 h1:ihbySMvVjLAeSH1IbfcRTkD/iNscyz8rGzjF/E5hV6U= 198 | golang.org/x/crypto v0.31.0/go.mod h1:kDsLvtWBEx7MV9tJOj9bnXsPbxwJQ6csT/x4KIN4Ssk= 199 | golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= 200 | golang.org/x/exp v0.0.0-20230626212559-97b1e661b5df h1:UA2aFVmmsIlefxMk29Dp2juaUSth8Pyn3Tq5Y5mJGME= 201 | golang.org/x/exp v0.0.0-20230626212559-97b1e661b5df/go.mod h1:FXUEEKJgO7OQYeo8N01OfiKP8RXMtf6e8aTskBGqWdc= 202 | golang.org/x/lint v0.0.0-20181026193005-c67002cb31c3/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE= 203 | golang.org/x/lint v0.0.0-20190227174305-5b3e6a55c961/go.mod h1:wehouNa3lNwaWXcvxsM5YxQ5yQlVC4a0KAMCusXpPoU= 204 | golang.org/x/lint v0.0.0-20190313153728-d0100b6bd8b3/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= 205 | golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4/go.mod h1:jJ57K6gSWd91VN4djpZkiMVwK6gcyfeH4XE8wZrZaV4= 206 | golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= 207 | golang.org/x/net v0.0.0-20180826012351-8a410e7b638d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= 208 | golang.org/x/net v0.0.0-20190108225652-1e06a53dbb7e/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= 209 | golang.org/x/net v0.0.0-20190213061140-3a22650c66bd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= 210 | golang.org/x/net v0.0.0-20190311183353-d8887717615a/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= 211 | golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= 212 | golang.org/x/net v0.0.0-20190603091049-60506f45cf65/go.mod h1:HSz+uSET+XFnRR8LxR5pz3Of3rY3CfYBVs4xY44aLks= 213 | golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= 214 | golang.org/x/net v0.0.0-20200822124328-c89045814202/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA= 215 | golang.org/x/net v0.0.0-20201110031124-69a78807bb2b/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= 216 | golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= 217 | golang.org/x/net v0.0.0-20211112202133-69e39bad7dc2/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= 218 | golang.org/x/net v0.0.0-20220722155237-a158d28d115b/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c= 219 | golang.org/x/net v0.21.0 h1:AQyQV4dYCvJ7vGmJyKki9+PBdyvhkSd8EIx/qb0AYv4= 220 | golang.org/x/net v0.21.0/go.mod h1:bIjVDfnllIU7BJ2DNgfnXvpSvtn8VRwhlsaeUTyUS44= 221 | golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= 222 | golang.org/x/oauth2 v0.0.0-20200107190931-bf48bf16ab8d/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= 223 | golang.org/x/oauth2 v0.9.0 h1:BPpt2kU7oMRq3kCHAA1tbSEshXRw1LpG2ztgDwrzuAs= 224 | golang.org/x/oauth2 v0.9.0/go.mod h1:qYgFZaFiu6Wg24azG8bdV52QJXJGbZzIIsRCdVKzbLw= 225 | golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= 226 | golang.org/x/sync v0.0.0-20181108010431-42b317875d0f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= 227 | golang.org/x/sync v0.0.0-20181221193216-37e7f081c4d4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= 228 | golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= 229 | golang.org/x/sync v0.0.0-20220722155255-886fb9371eb4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= 230 | golang.org/x/sync v0.10.0 h1:3NQrjDixjgGwUOCaF8w2+VYHv0Ve/vGYSbdkTa98gmQ= 231 | golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= 232 | golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= 233 | golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= 234 | golang.org/x/sys v0.0.0-20200323222414-85ca7c5b95cd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= 235 | golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= 236 | golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= 237 | golang.org/x/sys v0.0.0-20210423082822-04245dca01da/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= 238 | golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= 239 | golang.org/x/sys v0.0.0-20220520151302-bc2c85ada10a/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= 240 | golang.org/x/sys v0.0.0-20220715151400-c0bba94af5f8/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= 241 | golang.org/x/sys v0.0.0-20220722155257-8c9f86f7a55f/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= 242 | golang.org/x/sys v0.0.0-20220811171246-fbc7d0a398ab/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= 243 | golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= 244 | golang.org/x/sys v0.28.0 h1:Fksou7UEQUWlKvIdsqzJmUmCX3cZuD2+P3XyyzwMhlA= 245 | golang.org/x/sys v0.28.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= 246 | golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= 247 | golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= 248 | golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= 249 | golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk= 250 | golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= 251 | golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= 252 | golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ= 253 | golang.org/x/text v0.3.8/go.mod h1:E6s5w1FMmriuDzIBO73fBruAKo1PCIq6d2Q6DHfQ8WQ= 254 | golang.org/x/text v0.21.0 h1:zyQAAkrwaneQ066sspRyJaG9VNi/YJ1NfzcGB3hZ/qo= 255 | golang.org/x/text v0.21.0/go.mod h1:4IBbMaMmOPCJ8SecivzSH54+73PCFmPWxNTLm+vZkEQ= 256 | golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= 257 | golang.org/x/tools v0.0.0-20190114222345-bf090417da8b/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= 258 | golang.org/x/tools v0.0.0-20190226205152-f727befe758c/go.mod h1:9Yl7xja0Znq3iFh3HoIrodX9oNMXvdceNzlUR8zjMvY= 259 | golang.org/x/tools v0.0.0-20190311212946-11955173bddd/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= 260 | golang.org/x/tools v0.0.0-20190524140312-2c0ae7006135/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q= 261 | golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= 262 | golang.org/x/tools v0.1.12/go.mod h1:hNGJHUnrk76NpqgfD5Aqm5Crs+Hm0VOH/i9J2+nxYbc= 263 | golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= 264 | golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= 265 | golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= 266 | google.golang.org/api v0.129.0 h1:2XbdjjNfFPXQyufzQVwPf1RRnHH8Den2pfNE2jw7L8w= 267 | google.golang.org/api v0.129.0/go.mod h1:dFjiXlanKwWE3612X97llhsoI36FAoIiRj3aTl5b/zE= 268 | google.golang.org/appengine v1.1.0/go.mod h1:EbEs0AVv82hx2wNQdGPgUI5lhzA/G0D9YwlJXL52JkM= 269 | google.golang.org/appengine v1.4.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4= 270 | google.golang.org/appengine v1.6.7 h1:FZR1q0exgwxzPzp/aF+VccGrSfxfPpkBqjIIEq3ru6c= 271 | google.golang.org/appengine v1.6.7/go.mod h1:8WjMMxjGQR8xUklV/ARdw2HLXBOI7O7uCIDZVag1xfc= 272 | google.golang.org/genproto v0.0.0-20180817151627-c66870c02cf8/go.mod h1:JiN7NxoALGmiZfu7CAH4rXhgtRTLTxftemlI0sWmxmc= 273 | google.golang.org/genproto v0.0.0-20190819201941-24fa4b261c55/go.mod h1:DMBHOl98Agz4BDEuKkezgsaosCRResVns1a3J2ZsMNc= 274 | google.golang.org/genproto v0.0.0-20200513103714-09dca8ec2884/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= 275 | google.golang.org/genproto v0.0.0-20200526211855-cb27e3aa2013/go.mod h1:NbSheEEYHJ7i3ixzK3sjbqSGDJWnxyFXZblF3eUsNvo= 276 | google.golang.org/genproto/googleapis/rpc v0.0.0-20230629202037-9506855d4529 h1:DEH99RbiLZhMxrpEJCZ0A+wdTe0EOgou/poSLx9vWf4= 277 | google.golang.org/genproto/googleapis/rpc v0.0.0-20230629202037-9506855d4529/go.mod h1:66JfowdXAEgad5O9NnYcsNPLCPZJD++2L9X0PCMODrA= 278 | google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c= 279 | google.golang.org/grpc v1.23.0/go.mod h1:Y5yQAOtifL1yxbo5wqy6BxZv8vAUGQwXBOALyacEbxg= 280 | google.golang.org/grpc v1.25.1/go.mod h1:c3i+UQWmh7LiEpx4sFZnkU36qjEYZ0imhYfXVyQciAY= 281 | google.golang.org/grpc v1.27.0/go.mod h1:qbnxyOmOxrQa7FizSgH+ReBfzJrCY1pSN7KXBS8abTk= 282 | google.golang.org/grpc v1.33.1/go.mod h1:fr5YgcSWrqhRRxogOsw7RzIpsmvOZ6IcH4kBYTpR3n0= 283 | google.golang.org/grpc v1.33.2/go.mod h1:JMHMWHQWaTccqQQlmk3MJZS+GWXOdAesneDmEnv2fbc= 284 | google.golang.org/grpc v1.36.0/go.mod h1:qjiiYl8FncCW8feJPdyg3v6XW24KsRHe+dy9BAGRRjU= 285 | google.golang.org/grpc v1.45.0/go.mod h1:lN7owxKUQEqMfSyQikvvk5tf/6zMPsrK+ONuO11+0rQ= 286 | google.golang.org/grpc v1.56.1 h1:z0dNfjIl0VpaZ9iSVjA6daGatAYwPGstTjt5vkRMFkQ= 287 | google.golang.org/grpc v1.56.1/go.mod h1:I9bI3vqKfayGqPUAwGdOSu7kt6oIJLixfffKrpXqQ9s= 288 | google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8= 289 | google.golang.org/protobuf v0.0.0-20200221191635-4d8936d0db64/go.mod h1:kwYJMbMJ01Woi6D6+Kah6886xMZcty6N08ah7+eCXa0= 290 | google.golang.org/protobuf v0.0.0-20200228230310-ab0ca4ff8a60/go.mod h1:cfTl7dwQJ+fmap5saPgwCLgHXTUD7jkjRqWcaiX5VyM= 291 | google.golang.org/protobuf v1.20.1-0.20200309200217-e05f789c0967/go.mod h1:A+miEFZTKqfCUM6K7xSMQL9OKL/b6hQv+e19PK+JZNE= 292 | google.golang.org/protobuf v1.21.0/go.mod h1:47Nbq4nVaFHyn7ilMalzfO3qCViNmqZ2kzikPIcrTAo= 293 | google.golang.org/protobuf v1.22.0/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU= 294 | google.golang.org/protobuf v1.23.0/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU= 295 | google.golang.org/protobuf v1.23.1-0.20200526195155-81db48ad09cc/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU= 296 | google.golang.org/protobuf v1.25.0/go.mod h1:9JNX74DMeImyA3h4bdi1ymwjUzf21/xIlbajtzgsN7c= 297 | google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw= 298 | google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= 299 | google.golang.org/protobuf v1.31.0 h1:g0LDEJHgrBl9N9r17Ru3sqWhkIx2NB67okBHPwC7hs8= 300 | google.golang.org/protobuf v1.31.0/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I= 301 | gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= 302 | gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk= 303 | gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= 304 | gopkg.in/yaml.v2 v2.2.3/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= 305 | gopkg.in/yaml.v2 v2.4.0 h1:D8xgwECY7CYvx+Y2n4sBz93Jn9JRvxdiyyo8CTfuKaY= 306 | gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ= 307 | gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= 308 | gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= 309 | gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= 310 | honnef.co/go/tools v0.0.0-20190102054323-c2f93a96b099/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= 311 | honnef.co/go/tools v0.0.0-20190523083050-ea95bdfd59fc/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= 312 | --------------------------------------------------------------------------------