Documentation ¶
Index ¶
- func IsNotFound(err error) bool
- type GitClient
- type SCMClient
- func (c *SCMClient) CreateBranch(ctx context.Context, repo, branch, sha string) error
- func (c *SCMClient) CreatePullRequest(ctx context.Context, repo string, inp *scm.PullRequestInput) (*scm.PullRequest, error)
- func (c *SCMClient) GetBranchHead(ctx context.Context, repo, branch string) (string, error)
- func (c *SCMClient) GetFile(ctx context.Context, repo, ref, path string) (*scm.Content, error)
- func (c *SCMClient) UpdateFile(ctx context.Context, repo, branch, path, message, previousSHA string, ...) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func IsNotFound ¶
IsNotFound returns true if the error represents a NotFound response from an upstream service.
Types ¶
type GitClient ¶
type GitClient interface { GetFile(ctx context.Context, repo, ref, path string) (*scm.Content, error) UpdateFile(ctx context.Context, repo, branch, path, message, previousSHA string, content []byte) error CreatePullRequest(ctx context.Context, repo string, inp *scm.PullRequestInput) (*scm.PullRequest, error) CreateBranch(ctx context.Context, repo, branch, sha string) error GetBranchHead(ctx context.Context, repo, branch string) (string, error) }
GitClient wraps go-scm's Client with a simplified API.
type SCMClient ¶
type SCMClient struct {
// contains filtered or unexported fields
}
SCMClient is a wrapper for the go-scm scm.Client with a simplified API.
func (*SCMClient) CreateBranch ¶
CreateBranch will create a new branch in the repo from the SHA.
func (*SCMClient) CreatePullRequest ¶
func (c *SCMClient) CreatePullRequest(ctx context.Context, repo string, inp *scm.PullRequestInput) (*scm.PullRequest, error)
CreatePullRequest creates a PullRequest with the provided input.
If an HTTP error is returned by the upstream service, an error with the response status code is returned.
func (*SCMClient) GetBranchHead ¶
GetBranchHead gets the head SHA for a specific branch.
If an HTTP error is returned by the upstream service, an error with the response status code is returned.
func (*SCMClient) GetFile ¶
GetFile reads the specific revision of a file from a repository.
If an HTTP error is returned by the upstream service, an error with the response status code is returned.
func (*SCMClient) UpdateFile ¶
func (c *SCMClient) UpdateFile(ctx context.Context, repo, branch, path, message, previousSHA string, content []byte) error
UpdateFile updates an existing file in a repository.
If an HTTP error is returned by the upstream service, an error with the response status code is returned.