gh

package
v0.16.6 Latest Latest
Warning

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

Go to latest
Published: Apr 29, 2024 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const SecondsToSleepWhenRateLimited = 30

Variables

This section is empty.

Functions

func GetErrorIssueTitle

func GetErrorIssueTitle(bot, packageName string) string

func GetUpdateIssueTitle

func GetUpdateIssueTitle(packageName, version string) string

Types

type BasePullRequest

type BasePullRequest struct {
	Owner                 string
	RepoName              string
	Branch                string
	PullRequestBaseBranch string
}

type GetPullRequest

type GetPullRequest struct {
	BasePullRequest
	PackageName string
	Version     string
}

type GitHubOperations

type GitHubOperations interface {
	CheckExistingIssue(ctx context.Context, r *Issues) (string, error)
	OpenIssue(ctx context.Context, r *Issues) (string, error)
	OpenPullRequest(ctx context.Context, pr *NewPullRequest) (string, error)
	AddReactionIssue(ctx context.Context, i *Issues, number int, reaction string) error
	HasExistingComment(ctx context.Context, r *Issues, issueNumber int, newComment string) (bool, error)
	CommentIssue(ctx context.Context, r *Issues, number int) (string, error)
	ListIssues(ctx context.Context, owner, repo, state string) ([]*github.Issue, error)
	ListPullRequests(ctx context.Context, owner, repo, state string) ([]*github.PullRequest, error)
}

type GitOptions

type GitOptions struct {
	GithubClient *github.Client
	MaxRetries   int
	Logger       *log.Logger
}

func (GitOptions) AddReactionIssue

func (o GitOptions) AddReactionIssue(ctx context.Context, i *Issues, number int, reaction string) error

func (GitOptions) CheckExistingIssue

func (o GitOptions) CheckExistingIssue(ctx context.Context, r *Issues) (int, error)

func (GitOptions) CloseIssue

func (o GitOptions) CloseIssue(background context.Context, organisation, name, comment string, i int) error

func (GitOptions) ClosePullRequest

func (o GitOptions) ClosePullRequest(ctx context.Context, owner, repo string, number int) error

func (GitOptions) CommentIssue

func (o GitOptions) CommentIssue(ctx context.Context, owner, repo, comment string, number int) (string, error)

func (GitOptions) HasExistingComment

func (o GitOptions) HasExistingComment(ctx context.Context, r *Issues, issueNumber int, newComment string) (bool, error)

func (GitOptions) LabelIssue

func (o GitOptions) LabelIssue(ctx context.Context, owner, repo string, number int, labels *[]string) error

func (GitOptions) ListBranches

func (o GitOptions) ListBranches(ctx context.Context, owner, repo string) ([]*github.Branch, error)

func (GitOptions) ListIssues

func (o GitOptions) ListIssues(ctx context.Context, owner, repo, state string) ([]*github.Issue, error)

func (GitOptions) ListPullRequests

func (o GitOptions) ListPullRequests(ctx context.Context, owner, repo, state string) ([]*github.PullRequest, error)

ListPullRequests returns a list of pull requests for a given state using pagination

func (GitOptions) ListRepositoryFiles added in v0.14.13

func (o GitOptions) ListRepositoryFiles(ctx context.Context, owner, repo, path, ref string) ([]*github.RepositoryContent, error)

func (GitOptions) OpenIssue

func (o GitOptions) OpenIssue(ctx context.Context, r *Issues) (string, error)

func (GitOptions) OpenPullRequest

func (o GitOptions) OpenPullRequest(ctx context.Context, pr *NewPullRequest) (*github.PullRequest, error)

OpenPullRequest opens a pull request on GitHub

func (GitOptions) RepositoryFilesContents added in v0.14.13

func (o GitOptions) RepositoryFilesContents(ctx context.Context, owner, repo, file, ref string) (*github.RepositoryContent, error)

func (GitOptions) SearchCode added in v0.14.13

func (o GitOptions) SearchCode(ctx context.Context, query string) (*github.CodeSearchResult, error)

SearchCode does a rate-limited search using the Github Code Search API. It does not currently do paginated search, that would be a good feature to add, but is not needed for it's immediate use case.

type Issues

type Issues struct {
	Owner       string
	RepoName    string
	PackageName string
	Comment     string
	Title       string
	Labels      []string
}

type NewPullRequest

type NewPullRequest struct {
	BasePullRequest
	Title string
	Body  string
}

type ReleaseOptions

type ReleaseOptions struct {
	GithubClient             *github.Client
	Logger                   *log.Logger
	BumpMajor                bool
	BumpMinor                bool
	BumpPatch                bool
	BumpPrereleaseWithPrefix string
	Dir                      string
}

func (ReleaseOptions) GetReleaseURL

func (o ReleaseOptions) GetReleaseURL(ctx context.Context, owner, repoName, v string) (string, error)

func (ReleaseOptions) Release

func (o ReleaseOptions) Release(ctx context.Context) error

Release will create a new GitHub release

Jump to

Keyboard shortcuts

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