pullrequest

package
v0.0.0-...-05801a8 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 26, 2025 License: Apache-2.0 Imports: 20 Imported by: 1

Documentation

Index

Constants

View Source
const (
	// EventName is the event name of github.EventName's
	EventName = "pull_request"

	// EventNameReview is the event name of github.EventName's
	EventNameReview = "pull_request_review"

	OpenedAction         = "opened"
	ReopenedAction       = "reopened"
	EditedAction         = "edited"
	LabeledAction        = "labeled"
	UnlabeledAction      = "unlabeled"
	ReviewRequested      = "review_requested"
	ReviewRequestRemoved = "review_request_removed"
	AssignedAction       = "assigned"
	UnassignedAction     = "unassigned"
	SynchronizeAction    = "synchronize"
	SubmittedAction      = "submitted"
)

Actions are used to identify registered callbacks.

Variables

View Source
var ErrEventActionNotFound = errors.New("event action was empty or nil")
View Source
var ErrLabelNotFound = errors.New("pull_request.Label was nil")
View Source
var ErrMismatchedEvent = errors.New("expected pull_request event")
View Source
var ErrMismatchedReviewEvent = errors.New("expected pull_request_review event")
View Source
var ErrPRNotFound = errors.New("event.pull_request was nil")

Functions

This section is empty.

Types

type Dispatcher

type Dispatcher interface {
	Dispatch(ctx context.Context, deliveryID string, eventName string, event *github.PullRequestEvent) error
	DispatchReview(ctx context.Context, deliveryID string, eventName string, event *github.PullRequestReviewEvent) error
}

func NewDispatcher

func NewDispatcher(eh EventHandler, ef EventFilter, m metrics.Emitter) Dispatcher

type EventFilter

type EventFilter interface {
	ShouldHandle(ctx context.Context, id id.PR) (bool, error)
}

func NewRepoFilter

func NewRepoFilter(store configstore.Getter[*RepoFilterCfg], dao gh.API) EventFilter

type EventHandler

type EventHandler interface {
	EvalAndReview(ctx context.Context, id id.PR, ghe input.GHE) error
	EvalAndReviewPREvent(ctx context.Context, id id.PR, event *github.PullRequestEvent) error
	EvalAndReviewPRReviewEvent(ctx context.Context, id id.PR, event *github.PullRequestReviewEvent) error
	EvalAndReviewDataEvent(ctx context.Context, metadata *datastore.Metadata) error
}

func NewEventHandler

func NewEventHandler(evaluator opa.Evaluator, reviewer review.Reviewer, metrics metrics.Emitter, adapter input.Adapter) EventHandler

type MockDispatcher

type MockDispatcher struct {
	mock.Mock
}

MockDispatcher is an autogenerated mock type for the Dispatcher type

func NewMockDispatcher

func NewMockDispatcher(t interface {
	mock.TestingT
	Cleanup(func())
}) *MockDispatcher

NewMockDispatcher creates a new instance of MockDispatcher. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations. The first argument is typically a *testing.T value.

func (*MockDispatcher) Dispatch

func (_m *MockDispatcher) Dispatch(ctx context.Context, deliveryID string, eventName string, event *github.PullRequestEvent) error

Dispatch provides a mock function with given fields: ctx, deliveryID, eventName, event

func (*MockDispatcher) DispatchReview

func (_m *MockDispatcher) DispatchReview(ctx context.Context, deliveryID string, eventName string, event *github.PullRequestReviewEvent) error

D provides a mock function with given fields: ctx, deliveryID, eventName, event

func (*MockDispatcher) EXPECT

type MockDispatcher_DispatchReview_Call

type MockDispatcher_DispatchReview_Call struct {
	*mock.Call
}

MockDispatcher_DispatchReview_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'DispatchReview'

func (*MockDispatcher_DispatchReview_Call) Return

func (*MockDispatcher_DispatchReview_Call) Run

func (*MockDispatcher_DispatchReview_Call) RunAndReturn

type MockDispatcher_Dispatch_Call

type MockDispatcher_Dispatch_Call struct {
	*mock.Call
}

MockDispatcher_Dispatch_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Dispatch'

func (*MockDispatcher_Dispatch_Call) Return

func (*MockDispatcher_Dispatch_Call) Run

func (_c *MockDispatcher_Dispatch_Call) Run(run func(ctx context.Context, deliveryID string, eventName string, event *github.PullRequestEvent)) *MockDispatcher_Dispatch_Call

func (*MockDispatcher_Dispatch_Call) RunAndReturn

type MockDispatcher_Expecter

type MockDispatcher_Expecter struct {
	// contains filtered or unexported fields
}

func (*MockDispatcher_Expecter) Dispatch

func (_e *MockDispatcher_Expecter) Dispatch(ctx interface{}, deliveryID interface{}, eventName interface{}, event interface{}) *MockDispatcher_Dispatch_Call

Dispatch is a helper method to define mock.On call

  • ctx context.Context
  • deliveryID string
  • eventName string
  • event *github.PullRequestEvent

func (*MockDispatcher_Expecter) DispatchReview

func (_e *MockDispatcher_Expecter) DispatchReview(ctx interface{}, deliveryID interface{}, eventName interface{}, event interface{}) *MockDispatcher_DispatchReview_Call

DispatchReview is a helper method to define mock.On call

  • ctx context.Context
  • deliveryID string
  • eventName string
  • event *github.PullRequestReviewEvent

type MockEventHandler

type MockEventHandler struct {
	mock.Mock
}

MockEventHandler is an autogenerated mock type for the EventHandler type

func NewMockEventHandler

func NewMockEventHandler(t interface {
	mock.TestingT
	Cleanup(func())
}) *MockEventHandler

NewMockEventHandler creates a new instance of MockEventHandler. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations. The first argument is typically a *testing.T value.

func (*MockEventHandler) EXPECT

func (*MockEventHandler) EvalAndReview

func (_m *MockEventHandler) EvalAndReview(ctx context.Context, _a1 id.PR, ghe input.GHE) error

EvalAndReview provides a mock function with given fields: ctx, _a1, ghe

func (*MockEventHandler) EvalAndReviewDataEvent

func (_m *MockEventHandler) EvalAndReviewDataEvent(ctx context.Context, metadata *datastore.Metadata) error

EvalAndReviewDataEvent provides a mock function with given fields: ctx, metadata

func (*MockEventHandler) EvalAndReviewPREvent

func (_m *MockEventHandler) EvalAndReviewPREvent(ctx context.Context, _a1 id.PR, event *github.PullRequestEvent) error

EvalAndReviewPREvent provides a mock function with given fields: ctx, _a1, event

func (*MockEventHandler) EvalAndReviewPRReviewEvent

func (_m *MockEventHandler) EvalAndReviewPRReviewEvent(ctx context.Context, _a1 id.PR, event *github.PullRequestReviewEvent) error

EvalAndReviewPRReviewEvent provides a mock function with given fields: ctx, _a1, event

type MockEventHandler_EvalAndReviewDataEvent_Call

type MockEventHandler_EvalAndReviewDataEvent_Call struct {
	*mock.Call
}

MockEventHandler_EvalAndReviewDataEvent_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'EvalAndReviewDataEvent'

func (*MockEventHandler_EvalAndReviewDataEvent_Call) Return

func (*MockEventHandler_EvalAndReviewDataEvent_Call) Run

func (*MockEventHandler_EvalAndReviewDataEvent_Call) RunAndReturn

type MockEventHandler_EvalAndReviewPREvent_Call

type MockEventHandler_EvalAndReviewPREvent_Call struct {
	*mock.Call
}

MockEventHandler_EvalAndReviewPREvent_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'EvalAndReviewPREvent'

func (*MockEventHandler_EvalAndReviewPREvent_Call) Return

func (*MockEventHandler_EvalAndReviewPREvent_Call) Run

func (*MockEventHandler_EvalAndReviewPREvent_Call) RunAndReturn

type MockEventHandler_EvalAndReviewPRReviewEvent_Call

type MockEventHandler_EvalAndReviewPRReviewEvent_Call struct {
	*mock.Call
}

MockEventHandler_EvalAndReviewPRReviewEvent_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'EvalAndReviewPRReviewEvent'

func (*MockEventHandler_EvalAndReviewPRReviewEvent_Call) Return

func (*MockEventHandler_EvalAndReviewPRReviewEvent_Call) Run

func (*MockEventHandler_EvalAndReviewPRReviewEvent_Call) RunAndReturn

type MockEventHandler_EvalAndReview_Call

type MockEventHandler_EvalAndReview_Call struct {
	*mock.Call
}

MockEventHandler_EvalAndReview_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'EvalAndReview'

func (*MockEventHandler_EvalAndReview_Call) Return

func (*MockEventHandler_EvalAndReview_Call) Run

func (*MockEventHandler_EvalAndReview_Call) RunAndReturn

type MockEventHandler_Expecter

type MockEventHandler_Expecter struct {
	// contains filtered or unexported fields
}

func (*MockEventHandler_Expecter) EvalAndReview

func (_e *MockEventHandler_Expecter) EvalAndReview(ctx interface{}, _a1 interface{}, ghe interface{}) *MockEventHandler_EvalAndReview_Call

EvalAndReview is a helper method to define mock.On call

  • ctx context.Context
  • _a1 id.PR
  • ghe input.GHE

func (*MockEventHandler_Expecter) EvalAndReviewDataEvent

func (_e *MockEventHandler_Expecter) EvalAndReviewDataEvent(ctx interface{}, metadata interface{}) *MockEventHandler_EvalAndReviewDataEvent_Call

EvalAndReviewDataEvent is a helper method to define mock.On call

  • ctx context.Context
  • metadata *datastore.Metadata

func (*MockEventHandler_Expecter) EvalAndReviewPREvent

func (_e *MockEventHandler_Expecter) EvalAndReviewPREvent(ctx interface{}, _a1 interface{}, event interface{}) *MockEventHandler_EvalAndReviewPREvent_Call

EvalAndReviewPREvent is a helper method to define mock.On call

  • ctx context.Context
  • _a1 id.PR
  • event *github.PullRequestEvent

func (*MockEventHandler_Expecter) EvalAndReviewPRReviewEvent

func (_e *MockEventHandler_Expecter) EvalAndReviewPRReviewEvent(ctx interface{}, _a1 interface{}, event interface{}) *MockEventHandler_EvalAndReviewPRReviewEvent_Call

EvalAndReviewPRReviewEvent is a helper method to define mock.On call

  • ctx context.Context
  • _a1 id.PR
  • event *github.PullRequestReviewEvent

type RepoFilterCfg

type RepoFilterCfg struct {
	Allowlist       []string         `dynamodbav:"allowlist"`
	Denylist        []string         `dynamodbav:"denylist"`
	IgnoreTopics    []string         `dynamodbav:"ignore_topics"`
	AllowlistRegex  []*regexp.Regexp `dynamodbav:"-"`
	DenylistRegex   []*regexp.Regexp `dynamodbav:"-"`
	IgnoreTopicsMap map[string]bool  `dynamodbav:"-"`
}

func (*RepoFilterCfg) Update

func (cfg *RepoFilterCfg) Update() error

Update hook will be called everytime configstore reads an updated value. It is used to populate regex and maps

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL