Documentation
¶
Overview ¶
Package scm is a generated GoMock package.
Index ¶
- Constants
- func DetectProvider(uri string) (model.SCMProvider, error)
- type Client
- type GitBranchStats
- type MergeError
- type MockClient
- func (m *MockClient) BranchStatus(ctx context.Context, owner, repo, sourceBranch, targetBranch string) (*GitBranchStats, error)
- func (m *MockClient) Comment(ctx context.Context, owner, repo string, number int, body string) error
- func (m *MockClient) CommentUpdate(ctx context.Context, owner, repo string, number int, key, body string) error
- func (m *MockClient) EXPECT() *MockClientMockRecorder
- func (m *MockClient) FetchRepositoryMetadata(ctx context.Context, identifier string) (*model.RepositoryMetadata, error)
- func (m *MockClient) GetPullRequest(ctx context.Context, owner, repo string, number int) (*PullRequest, error)
- func (m *MockClient) MergePR(ctx context.Context, owner, repo string, number int, headSHA string) error
- func (m *MockClient) SetStatus(ctx context.Context, owner, repo, sha, state, description, targetURL string) error
- type MockClientMockRecorder
- func (mr *MockClientMockRecorder) BranchStatus(ctx, owner, repo, sourceBranch, targetBranch any) *gomock.Call
- func (mr *MockClientMockRecorder) Comment(ctx, owner, repo, number, body any) *gomock.Call
- func (mr *MockClientMockRecorder) CommentUpdate(ctx, owner, repo, number, key, body any) *gomock.Call
- func (mr *MockClientMockRecorder) FetchRepositoryMetadata(ctx, identifier any) *gomock.Call
- func (mr *MockClientMockRecorder) GetPullRequest(ctx, owner, repo, number any) *gomock.Call
- func (mr *MockClientMockRecorder) MergePR(ctx, owner, repo, number, headSHA any) *gomock.Call
- func (mr *MockClientMockRecorder) SetStatus(ctx, owner, repo, sha, state, description, targetURL any) *gomock.Call
- type PullRequest
- type WebhookEvent
Constants ¶
const ( EventComment = "COMMENT" EventPing = "PING" )
Variables ¶
This section is empty.
Functions ¶
func DetectProvider ¶
func DetectProvider(uri string) (model.SCMProvider, error)
DetectProvider tenta detectar o provider SCM baseado na URI Suporta Azure DevOps, GitHub e GitLab na nuvem Para instalações self-hosted, o provider deve ser informado explicitamente
Types ¶
type Client ¶
type Client interface {
GetPullRequest(ctx context.Context, owner, repo string, number int) (*PullRequest, error)
BranchStatus(ctx context.Context, owner, repo string, sourceBranch, targetBranch string) (*GitBranchStats, error)
// Comment creates a new PR thread. Always posts a new comment, no deduplication.
Comment(ctx context.Context, owner, repo string, number int, body string) error
// CommentUpdate upserts a PR comment identified by key.
// If a previous comment with the same key exists it is updated; otherwise a new one is created.
CommentUpdate(ctx context.Context, owner, repo string, number int, key, body string) error
SetStatus(ctx context.Context, owner, repo, sha string, state string, description string, targetURL string) error
// MergePR completa (merge) o pull request especificado
MergePR(ctx context.Context, owner, repo string, number int, headSHA string) error
// FetchRepositoryMetadata busca metadados completos do repositório via API do provider
// Aceita URI ou ID nativo como identificador
// Retorna RepositoryMetadata completo com ID nativo, nome, URI e metadados específicos do provider
FetchRepositoryMetadata(ctx context.Context, identifier string) (*model.RepositoryMetadata, error)
}
type GitBranchStats ¶
type MergeError ¶
type MergeError struct {
Err error
Code int // HTTP status code; 0 for network/transport errors
Retryable bool
}
MergeError wraps an SCM merge failure with an HTTP status code and a retryability flag.
Retryable=true → transient: network errors (Code 0), 400 (policy/conflict), 5xx Retryable=false → permanent: 401 (invalid PAT), 403 (no permission), 404 (not found)
func NewMergeError ¶
func NewMergeError(err error, code int) *MergeError
NewMergeError builds a MergeError from a raw error and its HTTP status code.
func (*MergeError) Error ¶
func (e *MergeError) Error() string
func (*MergeError) Unwrap ¶
func (e *MergeError) Unwrap() error
type MockClient ¶
type MockClient struct {
// contains filtered or unexported fields
}
MockClient is a mock of Client interface.
func NewMockClient ¶
func NewMockClient(ctrl *gomock.Controller) *MockClient
NewMockClient creates a new mock instance.
func (*MockClient) BranchStatus ¶
func (m *MockClient) BranchStatus(ctx context.Context, owner, repo, sourceBranch, targetBranch string) (*GitBranchStats, error)
BranchStatus mocks base method.
func (*MockClient) Comment ¶
func (m *MockClient) Comment(ctx context.Context, owner, repo string, number int, body string) error
Comment mocks base method.
func (*MockClient) CommentUpdate ¶
func (m *MockClient) CommentUpdate(ctx context.Context, owner, repo string, number int, key, body string) error
CommentUpdate mocks base method.
func (*MockClient) EXPECT ¶
func (m *MockClient) EXPECT() *MockClientMockRecorder
EXPECT returns an object that allows the caller to indicate expected use.
func (*MockClient) FetchRepositoryMetadata ¶
func (m *MockClient) FetchRepositoryMetadata(ctx context.Context, identifier string) (*model.RepositoryMetadata, error)
FetchRepositoryMetadata mocks base method.
func (*MockClient) GetPullRequest ¶
func (m *MockClient) GetPullRequest(ctx context.Context, owner, repo string, number int) (*PullRequest, error)
GetPullRequest mocks base method.
type MockClientMockRecorder ¶
type MockClientMockRecorder struct {
// contains filtered or unexported fields
}
MockClientMockRecorder is the mock recorder for MockClient.
func (*MockClientMockRecorder) BranchStatus ¶
func (mr *MockClientMockRecorder) BranchStatus(ctx, owner, repo, sourceBranch, targetBranch any) *gomock.Call
BranchStatus indicates an expected call of BranchStatus.
func (*MockClientMockRecorder) Comment ¶
func (mr *MockClientMockRecorder) Comment(ctx, owner, repo, number, body any) *gomock.Call
Comment indicates an expected call of Comment.
func (*MockClientMockRecorder) CommentUpdate ¶
func (mr *MockClientMockRecorder) CommentUpdate(ctx, owner, repo, number, key, body any) *gomock.Call
CommentUpdate indicates an expected call of CommentUpdate.
func (*MockClientMockRecorder) FetchRepositoryMetadata ¶
func (mr *MockClientMockRecorder) FetchRepositoryMetadata(ctx, identifier any) *gomock.Call
FetchRepositoryMetadata indicates an expected call of FetchRepositoryMetadata.
func (*MockClientMockRecorder) GetPullRequest ¶
func (mr *MockClientMockRecorder) GetPullRequest(ctx, owner, repo, number any) *gomock.Call
GetPullRequest indicates an expected call of GetPullRequest.