github

package
v0.5.0 Latest Latest
Warning

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

Go to latest
Published: Sep 7, 2021 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const (
	GitProviderName    = "github"
	EksaGithubTokenEnv = "EKSA_GITHUB_TOKEN"
	GithubTokenEnv     = "GITHUB_TOKEN"
)

Variables

This section is empty.

Functions

func GetGithubAccessTokenFromEnv

func GetGithubAccessTokenFromEnv() (string, error)

func New

func New(gitProviderClient GitProviderClient, githubProviderClient GithubProviderClient, opts Options, auth git.TokenAuth) (git.Provider, error)

Types

type GitProviderClient

type GitProviderClient interface {
	Add(filename string) error
	Remove(filename string) error
	Clone(ctx context.Context, repourl string) error
	Commit(message string) error
	Push(ctx context.Context) error
	Pull(ctx context.Context, branch string) error
	Init(url string) error
	Branch(name string) error
	SetTokenAuth(token string, username string)
}

GitProviderClient represents the attributes that the GitHub provider requires of a low-level git implementation (e.g. gogit) in order to function. Any basic git implementation (gogit, an executable wrapper, etc) which supports these methods can be used by the GitHub specific provider.

type GitProviderNotFoundError

type GitProviderNotFoundError struct {
	Provider string
}

func (*GitProviderNotFoundError) Error

func (e *GitProviderNotFoundError) Error() string

type GithubProviderClient

type GithubProviderClient interface {
	GetRepo(ctx context.Context, opts git.GetRepoOpts) (repo *git.Repository, err error)
	CreateRepo(ctx context.Context, opts git.CreateRepoOpts) (repo *git.Repository, err error)
	AuthenticatedUser(ctx context.Context) (*goGithub.User, error)
	Organization(ctx context.Context, org string) (*goGithub.Organization, error)
	GetAccessTokenPermissions(accessToken string) (string, error)
	CheckAccessTokenPermissions(checkPATPermission string, allPermissionScopes string) error
	PathExists(ctx context.Context, owner, repo, branch, path string) (bool, error)
}

GithubProviderClient represents the attributes that the Github provider requires of a library to directly connect to and interact with the Github API.

type Options

type Options struct {
	Repository string
	Owner      string
	Personal   bool
}

Directories

Path Synopsis
Package mocks is a generated GoMock package.
Package mocks is a generated GoMock package.

Jump to

Keyboard shortcuts

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