github

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: 11 Imported by: 1

Documentation

Index

Constants

View Source
const (
	Approve          = "APPROVE"
	RequestChanges   = "REQUEST_CHANGES"
	Comment          = "COMMENT"
	LGTM             = "LGTM! :rocket: :tada: :100:"
	ApprovalTemplate = `` /* 133-byte string literal not displayed */

	ErrorTemplate = `
<details>
	<summary>:warning: %v :warning: </summary>

~~~json
%v
~~~

</details>
`
)

Variables

This section is empty.

Functions

This section is empty.

Types

type API

type API interface {
	ListReviews(ctx context.Context, id id.PR) ([]*github.PullRequestReview, error)
	AddReview(ctx context.Context, id id.PR, summary, event string) error
	DismissReview(ctx context.Context, id id.PR, reviewID int64, message string) error
	EnableAutoMerge(ctx context.Context, id id.PR, method githubv4.PullRequestMergeMethod) error
	IssueComment(ctx context.Context, id id.PR, comment string) error
	IssueCommentForError(ctx context.Context, id id.PR, err pe.APIError) error
	ListAllTopics(ctx context.Context, id id.PR) ([]string, error)
	ListRequiredStatusChecks(ctx context.Context, id id.PR, branch string) ([]string, error)
	ListFilesInRootDir(ctx context.Context, id id.PR, branch string) ([]string, error)
	ListFilesChangedInPR(ctx context.Context, id id.PR) ([]*github.CommitFile, error)
	GetBranchProtection(ctx context.Context, id id.PR, branch string) (*github.Protection, error)
	ListNamesOfFilesChangedInPR(ctx context.Context, id id.PR) ([]string, error)
	GetPullRequest(ctx context.Context, id id.PR) (*github.PullRequest, error)
	GetRepository(ctx context.Context, id id.PR) (*github.Repository, error)
	GetOrganization(ctx context.Context, id id.PR) (*github.Organization, error)
}

func NewAPI

func NewAPI(serverHost string, serverPort int, v3 *github.Client, v4 *githubv4.Client, metrics metrics.Emitter) API

type ApprovalMessage

type ApprovalMessage struct {
	RequestID string `json:"request_id"`
}

type ErrorMessage

type ErrorMessage struct {
	Error     string `json:"error"`
	RequestID string `json:"request_id"`
}

type MockAPI

type MockAPI struct {
	mock.Mock
}

MockAPI is an autogenerated mock type for the API type

func NewMockAPI

func NewMockAPI(t interface {
	mock.TestingT
	Cleanup(func())
}) *MockAPI

NewMockAPI creates a new instance of MockAPI. 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 (*MockAPI) AddReview

func (_m *MockAPI) AddReview(ctx context.Context, _a1 id.PR, summary string, event string) error

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

func (*MockAPI) DismissReview

func (_m *MockAPI) DismissReview(ctx context.Context, _a1 id.PR, reviewID int64, message string) error

DismissReview provides a mock function with given fields: ctx, _a1, reviewID, message

func (*MockAPI) EXPECT

func (_m *MockAPI) EXPECT() *MockAPI_Expecter

func (*MockAPI) EnableAutoMerge

func (_m *MockAPI) EnableAutoMerge(ctx context.Context, _a1 id.PR, method githubv4.PullRequestMergeMethod) error

EnableAutoMerge provides a mock function with given fields: ctx, _a1, method

func (*MockAPI) GetBranchProtection

func (_m *MockAPI) GetBranchProtection(ctx context.Context, _a1 id.PR, branch string) (*v50github.Protection, error)

GetBranchProtection provides a mock function with given fields: ctx, _a1, branch

func (*MockAPI) GetOrganization

func (_m *MockAPI) GetOrganization(ctx context.Context, _a1 id.PR) (*v50github.Organization, error)

GetOrganization provides a mock function with given fields: ctx, _a1

func (*MockAPI) GetPullRequest

func (_m *MockAPI) GetPullRequest(ctx context.Context, _a1 id.PR) (*v50github.PullRequest, error)

GetPullRequest provides a mock function with given fields: ctx, _a1

func (*MockAPI) GetRepository

func (_m *MockAPI) GetRepository(ctx context.Context, _a1 id.PR) (*v50github.Repository, error)

GetRepository provides a mock function with given fields: ctx, _a1

func (*MockAPI) IssueComment

func (_m *MockAPI) IssueComment(ctx context.Context, _a1 id.PR, comment string) error

IssueComment provides a mock function with given fields: ctx, _a1, comment

func (*MockAPI) IssueCommentForError

func (_m *MockAPI) IssueCommentForError(ctx context.Context, _a1 id.PR, err errors.APIError) error

IssueCommentForError provides a mock function with given fields: ctx, _a1, err

func (*MockAPI) ListAllTopics

func (_m *MockAPI) ListAllTopics(ctx context.Context, _a1 id.PR) ([]string, error)

ListAllTopics provides a mock function with given fields: ctx, _a1

func (*MockAPI) ListFilesChangedInPR

func (_m *MockAPI) ListFilesChangedInPR(ctx context.Context, _a1 id.PR) ([]*v50github.CommitFile, error)

ListFilesChangedInPR provides a mock function with given fields: ctx, _a1

func (*MockAPI) ListFilesInRootDir

func (_m *MockAPI) ListFilesInRootDir(ctx context.Context, _a1 id.PR, branch string) ([]string, error)

ListFilesInRootDir provides a mock function with given fields: ctx, _a1, branch

func (*MockAPI) ListNamesOfFilesChangedInPR

func (_m *MockAPI) ListNamesOfFilesChangedInPR(ctx context.Context, _a1 id.PR) ([]string, error)

ListNamesOfFilesChangedInPR provides a mock function with given fields: ctx, _a1

func (*MockAPI) ListRequiredStatusChecks

func (_m *MockAPI) ListRequiredStatusChecks(ctx context.Context, _a1 id.PR, branch string) ([]string, error)

ListRequiredStatusChecks provides a mock function with given fields: ctx, _a1, branch

func (*MockAPI) ListReviews

func (_m *MockAPI) ListReviews(ctx context.Context, _a1 id.PR) ([]*v50github.PullRequestReview, error)

ListReviews provides a mock function with given fields: ctx, _a1

type MockAPI_AddReview_Call

type MockAPI_AddReview_Call struct {
	*mock.Call
}

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

func (*MockAPI_AddReview_Call) Return

func (*MockAPI_AddReview_Call) Run

func (_c *MockAPI_AddReview_Call) Run(run func(ctx context.Context, _a1 id.PR, summary string, event string)) *MockAPI_AddReview_Call

func (*MockAPI_AddReview_Call) RunAndReturn

type MockAPI_EnableAutoMerge_Call

type MockAPI_EnableAutoMerge_Call struct {
	*mock.Call
}

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

func (*MockAPI_EnableAutoMerge_Call) Return

func (*MockAPI_EnableAutoMerge_Call) Run

func (*MockAPI_EnableAutoMerge_Call) RunAndReturn

type MockAPI_Expecter

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

func (*MockAPI_Expecter) AddReview

func (_e *MockAPI_Expecter) AddReview(ctx interface{}, _a1 interface{}, summary interface{}, event interface{}) *MockAPI_AddReview_Call

AddReview is a helper method to define mock.On call

  • ctx context.Context
  • _a1 id.PR
  • summary string
  • event string

func (*MockAPI_Expecter) EnableAutoMerge

func (_e *MockAPI_Expecter) EnableAutoMerge(ctx interface{}, _a1 interface{}, method interface{}) *MockAPI_EnableAutoMerge_Call

EnableAutoMerge is a helper method to define mock.On call

  • ctx context.Context
  • _a1 id.PR
  • method githubv4.PullRequestMergeMethod

func (*MockAPI_Expecter) GetBranchProtection

func (_e *MockAPI_Expecter) GetBranchProtection(ctx interface{}, _a1 interface{}, branch interface{}) *MockAPI_GetBranchProtection_Call

GetBranchProtection is a helper method to define mock.On call

  • ctx context.Context
  • _a1 id.PR
  • branch string

func (*MockAPI_Expecter) GetOrganization

func (_e *MockAPI_Expecter) GetOrganization(ctx interface{}, _a1 interface{}) *MockAPI_GetOrganization_Call

GetOrganization is a helper method to define mock.On call

  • ctx context.Context
  • _a1 id.PR

func (*MockAPI_Expecter) GetPullRequest

func (_e *MockAPI_Expecter) GetPullRequest(ctx interface{}, _a1 interface{}) *MockAPI_GetPullRequest_Call

GetPullRequest is a helper method to define mock.On call

  • ctx context.Context
  • _a1 id.PR

func (*MockAPI_Expecter) GetRepository

func (_e *MockAPI_Expecter) GetRepository(ctx interface{}, _a1 interface{}) *MockAPI_GetRepository_Call

GetRepository is a helper method to define mock.On call

  • ctx context.Context
  • _a1 id.PR

func (*MockAPI_Expecter) IssueComment

func (_e *MockAPI_Expecter) IssueComment(ctx interface{}, _a1 interface{}, comment interface{}) *MockAPI_IssueComment_Call

IssueComment is a helper method to define mock.On call

  • ctx context.Context
  • _a1 id.PR
  • comment string

func (*MockAPI_Expecter) IssueCommentForError

func (_e *MockAPI_Expecter) IssueCommentForError(ctx interface{}, _a1 interface{}, err interface{}) *MockAPI_IssueCommentForError_Call

IssueCommentForError is a helper method to define mock.On call

  • ctx context.Context
  • _a1 id.PR
  • err errors.APIError

func (*MockAPI_Expecter) ListAllTopics

func (_e *MockAPI_Expecter) ListAllTopics(ctx interface{}, _a1 interface{}) *MockAPI_ListAllTopics_Call

ListAllTopics is a helper method to define mock.On call

  • ctx context.Context
  • _a1 id.PR

func (*MockAPI_Expecter) ListFilesChangedInPR

func (_e *MockAPI_Expecter) ListFilesChangedInPR(ctx interface{}, _a1 interface{}) *MockAPI_ListFilesChangedInPR_Call

ListFilesChangedInPR is a helper method to define mock.On call

  • ctx context.Context
  • _a1 id.PR

func (*MockAPI_Expecter) ListFilesInRootDir

func (_e *MockAPI_Expecter) ListFilesInRootDir(ctx interface{}, _a1 interface{}, branch interface{}) *MockAPI_ListFilesInRootDir_Call

ListFilesInRootDir is a helper method to define mock.On call

  • ctx context.Context
  • _a1 id.PR
  • branch string

func (*MockAPI_Expecter) ListNamesOfFilesChangedInPR

func (_e *MockAPI_Expecter) ListNamesOfFilesChangedInPR(ctx interface{}, _a1 interface{}) *MockAPI_ListNamesOfFilesChangedInPR_Call

ListNamesOfFilesChangedInPR is a helper method to define mock.On call

  • ctx context.Context
  • _a1 id.PR

func (*MockAPI_Expecter) ListRequiredStatusChecks

func (_e *MockAPI_Expecter) ListRequiredStatusChecks(ctx interface{}, _a1 interface{}, branch interface{}) *MockAPI_ListRequiredStatusChecks_Call

ListRequiredStatusChecks is a helper method to define mock.On call

  • ctx context.Context
  • _a1 id.PR
  • branch string

func (*MockAPI_Expecter) ListReviews

func (_e *MockAPI_Expecter) ListReviews(ctx interface{}, _a1 interface{}) *MockAPI_ListReviews_Call

ListReviews is a helper method to define mock.On call

  • ctx context.Context
  • _a1 id.PR

type MockAPI_GetBranchProtection_Call

type MockAPI_GetBranchProtection_Call struct {
	*mock.Call
}

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

func (*MockAPI_GetBranchProtection_Call) Return

func (*MockAPI_GetBranchProtection_Call) Run

func (*MockAPI_GetBranchProtection_Call) RunAndReturn

type MockAPI_GetOrganization_Call

type MockAPI_GetOrganization_Call struct {
	*mock.Call
}

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

func (*MockAPI_GetOrganization_Call) Return

func (*MockAPI_GetOrganization_Call) Run

func (*MockAPI_GetOrganization_Call) RunAndReturn

type MockAPI_GetPullRequest_Call

type MockAPI_GetPullRequest_Call struct {
	*mock.Call
}

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

func (*MockAPI_GetPullRequest_Call) Return

func (*MockAPI_GetPullRequest_Call) Run

func (*MockAPI_GetPullRequest_Call) RunAndReturn

type MockAPI_GetRepository_Call

type MockAPI_GetRepository_Call struct {
	*mock.Call
}

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

func (*MockAPI_GetRepository_Call) Return

func (*MockAPI_GetRepository_Call) Run

func (*MockAPI_GetRepository_Call) RunAndReturn

type MockAPI_IssueCommentForError_Call

type MockAPI_IssueCommentForError_Call struct {
	*mock.Call
}

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

func (*MockAPI_IssueCommentForError_Call) Return

func (*MockAPI_IssueCommentForError_Call) Run

func (*MockAPI_IssueCommentForError_Call) RunAndReturn

type MockAPI_IssueComment_Call

type MockAPI_IssueComment_Call struct {
	*mock.Call
}

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

func (*MockAPI_IssueComment_Call) Return

func (*MockAPI_IssueComment_Call) Run

func (_c *MockAPI_IssueComment_Call) Run(run func(ctx context.Context, _a1 id.PR, comment string)) *MockAPI_IssueComment_Call

func (*MockAPI_IssueComment_Call) RunAndReturn

type MockAPI_ListAllTopics_Call

type MockAPI_ListAllTopics_Call struct {
	*mock.Call
}

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

func (*MockAPI_ListAllTopics_Call) Return

func (*MockAPI_ListAllTopics_Call) Run

func (*MockAPI_ListAllTopics_Call) RunAndReturn

type MockAPI_ListFilesChangedInPR_Call

type MockAPI_ListFilesChangedInPR_Call struct {
	*mock.Call
}

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

func (*MockAPI_ListFilesChangedInPR_Call) Return

func (*MockAPI_ListFilesChangedInPR_Call) Run

func (*MockAPI_ListFilesChangedInPR_Call) RunAndReturn

type MockAPI_ListFilesInRootDir_Call

type MockAPI_ListFilesInRootDir_Call struct {
	*mock.Call
}

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

func (*MockAPI_ListFilesInRootDir_Call) Return

func (*MockAPI_ListFilesInRootDir_Call) Run

func (*MockAPI_ListFilesInRootDir_Call) RunAndReturn

type MockAPI_ListNamesOfFilesChangedInPR_Call

type MockAPI_ListNamesOfFilesChangedInPR_Call struct {
	*mock.Call
}

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

func (*MockAPI_ListNamesOfFilesChangedInPR_Call) Return

func (*MockAPI_ListNamesOfFilesChangedInPR_Call) Run

func (*MockAPI_ListNamesOfFilesChangedInPR_Call) RunAndReturn

type MockAPI_ListRequiredStatusChecks_Call

type MockAPI_ListRequiredStatusChecks_Call struct {
	*mock.Call
}

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

func (*MockAPI_ListRequiredStatusChecks_Call) Return

func (*MockAPI_ListRequiredStatusChecks_Call) Run

func (*MockAPI_ListRequiredStatusChecks_Call) RunAndReturn

type MockAPI_ListReviews_Call

type MockAPI_ListReviews_Call struct {
	*mock.Call
}

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

func (*MockAPI_ListReviews_Call) Return

func (*MockAPI_ListReviews_Call) Run

func (*MockAPI_ListReviews_Call) RunAndReturn

Jump to

Keyboard shortcuts

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