Documentation
¶
Index ¶
- type Client
- type Github
- func (gh *Github) ClosePullRequests(prs []int, removeRemoteBranch bool) error
- func (gh *Github) CreatePullRequest(ctx context.Context, title, head, base, body string) (string, int, error)
- func (gh *Github) CreatePullRequestComment(ctx context.Context, id int, text string) error
- func (gh *Github) FindPullRequests(ctx context.Context, owner, titleMatch string) (prs []*PullRequest, err error)
- func (gh *Github) PullRequestFiles(ctx context.Context, number int) (created, removed, modified []string, err error)
- func (gh *Github) RemoveRemoveRef(ctx context.Context, ref string) error
- func (gh *Github) RequestReviewers(pr int, names []string) error
- type Option
- type PullRequest
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Client ¶
type Client interface { // PullRequestFiles returns a list of files used in a particular pull request. PullRequestFiles(ctx context.Context, number int) (created, removed, modified []string, err error) // CreatePullRequest creates a new pull request. CreatePullRequest(ctx context.Context, title, head, base, body string) (string, int, error) // ClosePullRequests closes pull requests. ClosePullRequests(prs []int, removeRemoteBranch bool) error // FindPullRequests searches pull requests with an owner and title. FindPullRequests(ctx context.Context, owner, titleMatch string) (prs []*PullRequest, err error) // RequestReviewers assigns the reviewers to a pull request. RequestReviewers(pr int, names []string) error // RemoveRemoveRef removes a reference from remote git repository. RemoveRemoveRef(ctx context.Context, ref string) error // CreatePullRequestComment creates a new comment on a pull request. CreatePullRequestComment(ctx context.Context, id int, text string) error }
Client is a github interface to interact with pull requests.
type Github ¶
type Github struct {
// contains filtered or unexported fields
}
Github is an abstraction over github API.
func (*Github) ClosePullRequests ¶
ClosePullRequests closes a list of pull requests.
func (*Github) CreatePullRequest ¶
func (gh *Github) CreatePullRequest(ctx context.Context, title, head, base, body string) (string, int, error)
CreatePullRequest creates a new pull request.
func (*Github) CreatePullRequestComment ¶
CreatePullRequestComment creates a new comment on a given pull request.
func (*Github) FindPullRequests ¶
func (gh *Github) FindPullRequests(ctx context.Context, owner, titleMatch string) (prs []*PullRequest, err error)
FindPullRequests searches and returns a list of pull requests.
func (*Github) PullRequestFiles ¶
func (gh *Github) PullRequestFiles(ctx context.Context, number int) (created, removed, modified []string, err error)
PullRequestFiles takes a github diffURL and returns a list of files affected by this pull request. Example diff url: https://github.com/owner/project/pull/95.diff
func (*Github) RemoveRemoveRef ¶
RemoveRemoveRef removes a remote reference.
type PullRequest ¶
type PullRequest struct { Number int Branch string SHA string CreatedAt *time.Time CreatedFiles []string RemovedFiles []string ModifiedFiles []string }
PullRequest is an abstraction represents a PR.
func (PullRequest) AllFiles ¶
func (pr PullRequest) AllFiles() []string
AllFiles returns a one slice for all files in pull requested (created, removed and modified)