Version: v1.2.0 Latest Latest

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

Go to latest
Published: Jan 28, 2021 License: Apache-2.0 Imports: 17 Imported by: 0




View Source
const (
	// EventTypeHeader represents the header key for event type of Github.
	EventTypeHeader = "X-Github-Event"


This section is empty.


func NewGithub

func NewGithub(scmCfg *v1alpha1.SCMSource) (scm.Provider, error)

NewGithub new Github client.

func ParseEvent

func ParseEvent(scmCfg *v1alpha1.SCMSource, request *http.Request) *scm.EventData

ParseEvent parses data from Github events.


type Github

type Github struct {
	// contains filtered or unexported fields

Github represents the SCM provider of Github.

func (*Github) CheckToken

func (g *Github) CheckToken() error

CheckToken checks whether the token has the authority of repo by trying ListRepos with the token

func (*Github) CreateStatus added in v0.9.6

func (g *Github) CreateStatus(status c_v1alpha1.StatusPhase, targetURL, repoURL, commitSHA string) error

CreateStatus generate a new status for repository.

func (*Github) CreateWebhook

func (g *Github) CreateWebhook(repo string, webhook *scm.Webhook) error

CreateWebhook creates webhook for specified repo.

func (*Github) DeleteWebhook

func (g *Github) DeleteWebhook(repo string, webhookURL string) error

DeleteWebhook deletes webhook from specified repo.

func (*Github) GetPullRequestSHA added in v0.9.6

func (g *Github) GetPullRequestSHA(repoURL string, number int) (string, error)

GetPullRequestSHA gets latest commit SHA of pull request.

func (*Github) GetToken

func (g *Github) GetToken() (string, error)

GetToken gets the token by the username and password of SCM config.

func (*Github) GetWebhook added in v0.9.6

func (g *Github) GetWebhook(repo string, webhookURL string) (*github.Hook, error)

GetWebhook gets webhook from specified repo.

func (*Github) ListBranches

func (g *Github) ListBranches(repo string) ([]string, error)

ListBranches lists the branches for specified repo.

func (*Github) ListDockerfiles

func (g *Github) ListDockerfiles(repo string) ([]string, error)

ListDockerfiles lists the dockerfiles for specified repo.

func (*Github) ListPullRequests added in v0.9.7

func (g *Github) ListPullRequests(repo, state string) ([]scm.PullRequest, error)

ListPullRequests lists the pull requests for specified repo.

func (*Github) ListRepos

func (g *Github) ListRepos() ([]scm.Repository, error)

ListRepos lists the repos by the SCM config.

func (*Github) ListTags

func (g *Github) ListTags(repo string) ([]string, error)

ListTags lists the tags for specified repo.

Source Files

Jump to

Keyboard shortcuts

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