github

package
v0.0.0-...-6801fd0 Latest Latest
Warning

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

Go to latest
Published: Jan 1, 2022 License: Apache-2.0 Imports: 12 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

View Source
const (
	MMREBASE = "rebase"
	MMMERGE  = "merge"
	MMSQUASH = "squash"
)
View Source
const (
	REBASE = "rebase"
	MERGE  = "merge"
	SQUASH = "squash"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Commit

type Commit struct {
	SHA     string       // SHA sum of the commit
	TreeSHA string       // SHA of the commmit's tree
	Parents []string     // SHAs of parent commits
	Files   []CommitFile // List of files modified in this commit
	// contains filtered or unexported fields
}

func NewCommit

func NewCommit() *Commit

func (*Commit) ChangeTree

func (c *Commit) ChangeTree() string

ChangeTree creates a sha1 sum of the changed files

type CommitFile

type CommitFile struct {
	Filename string
	SHA      string
}

CommitFile abstracts a file changed in a commit

type CommitImplementation

type CommitImplementation interface {
	ChangeTree([]CommitFile) string
}

type GitHub

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

func New

func New() *GitHub

New returns a new GitHub client

func NewWithOptions

func NewWithOptions(opts *Options) *GitHub

func (*GitHub) GetPullRequest

func (gh *GitHub) GetPullRequest(ctx context.Context, owner, repo string, number int) (*PullRequest, error)

GetPullRequest fetches a PR from github

type Issue

type Issue struct {
	Title     string
	Body      string
	RepoOwner string
	RepoName  string
	Username  string
	State     string
	Number    int
	Labels    []string
	// contains filtered or unexported fields
}

type IssueImplementation

type IssueImplementation interface{}

type NewPullRequestOptions

type NewPullRequestOptions struct {
	MaintainerCanModify bool
}

type Options

type Options struct{}

type PRImplementation

type PRImplementation interface {
	// contains filtered or unexported methods
}

type PullRequest

type PullRequest struct {
	Merged              *bool
	MaintainerCanModify *bool
	MilestoneNumber     *int64
	MilestoneTitle      *string
	CreatedAt           time.Time
	RepoOwner           string
	RepoName            string
	FullName            string
	Username            string
	Ref                 string
	Sha                 string
	State               string
	BuildStatus         string
	BuildConclusion     string
	BuildLink           string
	URL                 string
	MergeCommitSHA      string `db:"-"`
	Labels              []string
	Number              int
	Repository          *Repository
	// contains filtered or unexported fields
}

func NewPullRequest

func NewPullRequest() *PullRequest

func (*PullRequest) GetCommits

func (pr *PullRequest) GetCommits(ctx context.Context) ([]*Commit, error)

GetCommits returns the list of commits the pull request merged into its target branch

func (*PullRequest) GetMergeMode

func (pr *PullRequest) GetMergeMode(ctx context.Context) (mode string, err error)

GetMergeMode returns a string describing the way the pull request was merged

func (*PullRequest) GetRebaseCommits

func (pr *PullRequest) GetRebaseCommits(ctx context.Context) (commitSHAs []string, err error)

GetRebaseCommits returns the sequence of commits created when the PR was merged. It should only be used by rebased PRs.

func (*PullRequest) GetRepository

func (pr *PullRequest) GetRepository(ctx context.Context) *Repository

GetRepository returns the Repository object representing the repo where the PR was filed

func (*PullRequest) PatchTreeID

func (pr *PullRequest) PatchTreeID(ctx context.Context) (parentNr int, err error)

PatchTreeID return the parent ID of the pull request merge commit

type Repository

type Repository struct {
	Owner                      string
	Name                       string
	BuildStatusContext         string
	InstanceSetupScript        string
	InstanceSetupUpgradeScript string
	JobName                    string
	GreetingTeam               string   // GreetingTeam is the GitHub team responsible for triaging non-member PRs for this repo.
	GreetingLabels             []string // GreetingLabels are the labels applied automatically to non-member PRs for this repo.
	// contains filtered or unexported fields
}

func NewRepository

func NewRepository(owner, name string) *Repository

func (*Repository) CreatePullRequest

func (repo *Repository) CreatePullRequest(
	ctx context.Context, head, base, title, body string, opts *NewPullRequestOptions,
) (*PullRequest, error)

CreatePullRequest creates a new pull request in the repository

func (*Repository) GetCommit

func (repo *Repository) GetCommit(ctx context.Context, sha string) (c *Commit, err error)

GetCommit fteches from the repository the commit at sha

func (*Repository) GetPullRequest

func (repo *Repository) GetPullRequest(ctx context.Context, number int) (pr *PullRequest, err error)

Jump to

Keyboard shortcuts

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