Documentation
¶
Index ¶
- type GitHub
- func (g *GitHub) DefaultBranch(ctx context.Context) string
- func (g *GitHub) Ensure(ctx context.Context, options PullRequestOptions) (*PullRequest, bool, error)
- func (g *GitHub) LinkedTopicIssues(topicSearchString string) string
- func (g *GitHub) RepoHost() string
- func (g *GitHub) RepoName() string
- func (g *GitHub) RepoOwner() string
- func (g *GitHub) Update(ctx context.Context, pr *PullRequest, options PullRequestOptions) (*PullRequest, error)
- type PullRequest
- type PullRequestOptions
- type PullRequester
- type Repo
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type GitHub ¶
type GitHub struct {
GraphQLClient *api.GraphQLClient
*github.Client
Host string
Owner string
Repository string
}
GitHub implements the PullRequester interface allowing to create pull requests for a given repository
func NewGitHubUpserter ¶
NewGitHubUpserter instanciates an upserter that uses the github API to create and update pull requests
func (*GitHub) DefaultBranch ¶
DefaultBranch returns the default branch of the remote repository
func (*GitHub) Ensure ¶
func (g *GitHub) Ensure(ctx context.Context, options PullRequestOptions) (*PullRequest, bool, error)
Ensure ensures a PR is opened for the head branch
func (*GitHub) LinkedTopicIssues ¶
LinkedTopicIssues returns the search URL for linked issues
func (*GitHub) RepoHost ¶
RepoHost implements the ghrepo.Interface interface required to call the github graphql API from https://github.com/cli/cli See https://github.com/cli/cli/blob/dc804d928714120a3f4b53f78847aec7ba282c63/internal/ghrepo/repo.go#L14
func (*GitHub) RepoName ¶
RepoName implements the ghrepo.Interface interface required to call the github graphql API from https://github.com/cli/cli See https://github.com/cli/cli/blob/dc804d928714120a3f4b53f78847aec7ba282c63/internal/ghrepo/repo.go#L14
func (*GitHub) RepoOwner ¶
RepoHost implements the ghrepo.Interface interface required to call the github graphql API from https://github.com/cli/cli See https://github.com/cli/cli/blob/dc804d928714120a3f4b53f78847aec7ba282c63/internal/ghrepo/repo.go#L14
func (*GitHub) Update ¶
func (g *GitHub) Update(ctx context.Context, pr *PullRequest, options PullRequestOptions) (*PullRequest, error)
Update implements the Update interface to update an existing pull request
type PullRequestOptions ¶
type PullRequestOptions struct {
Base string
Head string
Title string
Body string
WIP bool
Ready bool
}
PullRequestOptions are the options available to create or update a pull request
type PullRequester ¶
type PullRequester interface {
// Update defines the interface to create or update a pull request to match options
Update(context.Context, *PullRequest, PullRequestOptions) (*PullRequest, error)
// Ensure ensures one and only one pull request exists for the given head
Ensure(context.Context, PullRequestOptions) (*PullRequest, bool, error)
LinkedTopicIssues(topicSearchString string) string
DefaultBranch(context.Context) string
}
PullRequester defines the interface to implement to handle pull requests
func NewPullRequester ¶
type Repo ¶
type Repo struct {
// Domain is the domain the API is exposed on
Domain string
// Repository is the name of the repository exposed on the API
// (owner/repository for github repositories)
Repository string
// Username contains the name of the authenticated user
// accessing the repository API
Username string
// Password contains the password of the authenticated user
// accessing the repository API
Password string
}
Repo describes how to reach a repository using an API
func NewRepoFromGitRemote ¶
NewRepoFromGitRemote parses the a git remote URL to determine the API configuration