func NewEventProcessor()

in pkg/event_processor/github/github.go [29:59]


func NewEventProcessor(
	ksClient ctrlClient.Reader,
	options *EventProcessorOptions,
) *EventProcessor {
	if options == nil {
		options = &EventProcessorOptions{}
	}

	if options.Logger == nil {
		options.Logger = zap.NewNop().Sugar()
	}

	if options.GitHubClient == nil {
		options.GitHubClient = func(ctx context.Context, token string) *github.Client {
			return github.NewClient(
				oauth2.NewClient(
					ctx,
					oauth2.StaticTokenSource(
						&oauth2.Token{AccessToken: token},
					),
				),
			)
		}
	}

	return &EventProcessor{
		ksClient:     ksClient,
		logger:       options.Logger,
		gitHubClient: options.GitHubClient,
	}
}