git

package
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: Dec 8, 2020 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func IsNotFound

func IsNotFound(err error) bool

IsNotFound returns true if the error represents a NotFound response from an upstream service.

Types

type SCM

type SCM interface {
	// ParseWebhookRequest returns the webhook payload.
	ParseWebhookRequest(req *http.Request) (scm.Webhook, error)
	// FileContents returns the contents of a file within a repo.
	FileContents(ctx context.Context, repo, path, ref string) ([]byte, error)
	// CreateStatus creates a new commit status for the repo/commit combination.
	CreateStatus(ctx context.Context, repo, commit string, s *scm.StatusInput) error
}

SCM is a wrapper around go-scm's Client implementation.

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 New

New creates and returns a new SCMClient.

func (*SCMClient) CreateStatus

func (c *SCMClient) CreateStatus(ctx context.Context, repo, commit string, s *scm.StatusInput) error

CreateStatus creates a commit status.

If an HTTP error is returned by the upstream service, an error with the response status code is returned.

func (*SCMClient) FileContents

func (c *SCMClient) FileContents(ctx context.Context, repo, path, ref string) ([]byte, error)

FileContents 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) ParseWebhookRequest

func (c *SCMClient) ParseWebhookRequest(req *http.Request) (scm.Webhook, error)

ParseWebhookRequest parses an incoming hook request and returns a parsed hook response if one can be matched.

Jump to

Keyboard shortcuts

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