github

package
v0.8.15 Latest Latest
Warning

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

Go to latest
Published: Feb 29, 2020 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Initialize

func Initialize(token string) error

Initialize create a github client.

Types

type CommitStatus

type CommitStatus struct {
	TargetSource *TargetSource
	State        State
	Description  Description
	Context      string
	TargetURL    *url.URL
}

CommitStatus represents a commit status

type Description

type Description string

Description explain a commit status

func (Description) TrimmedString

func (d Description) TrimmedString() string

TrimmedString returns length-fixed description

type GitHub

type GitHub interface {
	GetPullRequest(ctx context.Context, repo Repository, num int) (*go_github.PullRequest, error)
	CreateCommitStatus(ctx context.Context, status CommitStatus) error
}

GitHub describes a github client.

func GetInstance

func GetInstance() (GitHub, error)

GetInstance returns a github client

type Repository

type Repository interface {
	GetFullName() string
	GetSSHURL() string
	GetCloneURL() string
}

Repository is a github repository

type RepositoryName

type RepositoryName string

RepositoryName is a github repository name.

func (RepositoryName) Owner

func (r RepositoryName) Owner() (string, error)

Owner get a repository owner.

func (RepositoryName) Repo

func (r RepositoryName) Repo() (string, error)

Repo get a repository name without owner.

func (RepositoryName) Split

func (r RepositoryName) Split() (owner string, repo string, err error)

Split repository name to owner and repo

type SimpleTargetPoint

type SimpleTargetPoint struct {
	Ref string
	SHA string
}

SimpleTargetPoint is a simple implementation for TargetPoint

func (*SimpleTargetPoint) GetHead

func (s *SimpleTargetPoint) GetHead() string

GetHead returns a SHA

func (*SimpleTargetPoint) GetRef

func (s *SimpleTargetPoint) GetRef() string

GetRef returns a Ref

type State

type State string

State represents state of commit status

const (
	// PENDING represents pending state.
	PENDING State = "pending"
	// SUCCESS represents success state.
	SUCCESS State = "success"
	// ERROR represents error state.
	ERROR State = "error"
	// FAILURE represents failure state.
	FAILURE State = "failure"
)

func (State) String

func (s State) String() string

String returns string value

type TargetPoint

type TargetPoint interface {
	GetRef() string
	GetHead() string
}

TargetPoint represents a target point for clone.

type TargetSource

type TargetSource struct {
	Repository
	Ref string
	SHA plumbing.Hash
}

TargetSource stores Repo, Ref and SHA for target

func (*TargetSource) GetRef

func (s *TargetSource) GetRef() string

GetRef returns a ref

func (*TargetSource) GetSHA

func (s *TargetSource) GetSHA() plumbing.Hash

GetSHA returns a hash

Directories

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

Jump to

Keyboard shortcuts

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