github

package
v0.2.1 Latest Latest
Warning

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

Go to latest
Published: Nov 6, 2019 License: MPL-2.0-no-copyleft-exception Imports: 7 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// DefaultUsername controls the default username in the event NoAuth is in
	// effect; if set it will be used, otherwise an API call will be made.
	DefaultUsername string

	// Readonly disables certain actions -- most of which write content back to
	// github -- to ensure testing can be done with a real github client, without
	// affecting too much ON github. This is set through config/service.go.
	Readonly bool
)

Functions

This section is empty.

Types

type Client

Client is the generic client to github operations.

func NewClientFromAccessToken

func NewClientFromAccessToken(accessToken string) Client

NewClientFromAccessToken turns an accessToken into a new Client.

type HTTPClient

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

HTTPClient encapsulates the "real world", or http client.

func (*HTTPClient) ClearStates

func (c *HTTPClient) ClearStates(ctx context.Context, repoName, sha string) error

ClearStates removes all status reports from a SHA in an attempt to restart the process.

func (*HTTPClient) CommentError

func (c *HTTPClient) CommentError(ctx context.Context, repoName string, prID int64, err error) error

CommentError is for commenting on PRs when there is no better means of bubbling up an error.

func (*HTTPClient) ErrorStatus

func (c *HTTPClient) ErrorStatus(ctx context.Context, owner, repo, name, sha, url string, outErr error) error

ErrorStatus updates the status for the sha for the given repo on github.

func (*HTTPClient) FinishedStatus

func (c *HTTPClient) FinishedStatus(ctx context.Context, owner, repo, name, sha, url string, status bool, addlMessage string) error

FinishedStatus updates the status for the sha for the given repo on github.

func (*HTTPClient) GetDiffFiles

func (c *HTTPClient) GetDiffFiles(ctx context.Context, repoName, base, head string) ([]string, error)

GetDiffFiles retrieves the files present in the diff between the base and the head.

func (*HTTPClient) GetFile

func (c *HTTPClient) GetFile(ctx context.Context, repoName, sha, filename string) ([]byte, error)

GetFile retrieves a file from github directly through the api. Used for retrieving our configuration yamls and other stuff.

func (*HTTPClient) GetFileList

func (c *HTTPClient) GetFileList(ctx context.Context, repoName, sha string) ([]string, error)

GetFileList finds all the files in the tree for the given repository

func (*HTTPClient) GetRefs

func (c *HTTPClient) GetRefs(ctx context.Context, repoName, sha string) ([]string, error)

GetRefs gets the refs that match the given SHA. Only heads and tags are considered.

func (*HTTPClient) GetRepository

func (c *HTTPClient) GetRepository(ctx context.Context, name string) (*github.Repository, error)

GetRepository retrieves the github response for a given repository.

func (*HTTPClient) GetSHA

func (c *HTTPClient) GetSHA(ctx context.Context, repoName, refName string) (string, error)

GetSHA retrieves the SHA for the branch in the given repository

func (*HTTPClient) MyLogin

func (c *HTTPClient) MyLogin(ctx context.Context) (string, error)

MyLogin returns the username calling out to the API with its key. Can either be seeded by OAuth or Personal Token.

func (*HTTPClient) MyRepositories

func (c *HTTPClient) MyRepositories(ctx context.Context) ([]*github.Repository, error)

MyRepositories returns all the writable repositories accessible to user owning the access key

func (*HTTPClient) PendingStatus

func (c *HTTPClient) PendingStatus(ctx context.Context, owner, repo, name, sha, url string) error

PendingStatus updates the status for the sha for the given repo on github.

func (*HTTPClient) SetupHook

func (c *HTTPClient) SetupHook(ctx context.Context, owner, repo, configAddress, hookSecret string) error

SetupHook sets up the pr webhook in github.

func (*HTTPClient) StartedStatus

func (c *HTTPClient) StartedStatus(ctx context.Context, owner, repo, name, sha, url string) error

StartedStatus updates the status for the sha for the given repo on github.

func (*HTTPClient) TeardownHook

func (c *HTTPClient) TeardownHook(ctx context.Context, owner, repo, hookURL string) error

TeardownHook removes the pr webhook in github.

Jump to

Keyboard shortcuts

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