Documentation
¶
Overview ¶
Package pr provides GitHub pull request operations.
Index ¶
- func AddPRReviewers(ctx context.Context, gh *github.Client, owner, repo string, number int, ...) (*github.PullRequest, error)
- func ApprovePR(ctx context.Context, gh *github.Client, owner, repo string, number int, ...) (*github.PullRequestReview, error)
- func ClosePR(ctx context.Context, gh *github.Client, owner, repo string, number int) (*github.PullRequest, error)
- func CommentPR(ctx context.Context, gh *github.Client, owner, repo string, number int, ...) (*github.PullRequestReview, error)
- func CreateIssueComment(ctx context.Context, gh *github.Client, owner, repo string, number int, ...) (*github.IssueComment, error)
- func CreateLineComment(ctx context.Context, gh *github.Client, owner, repo string, number int, ...) (*github.PullRequestComment, error)
- func CreatePR(ctx context.Context, gh *github.Client, ...) (*github.PullRequest, error)
- func CreateReview(ctx context.Context, gh *github.Client, owner, repo string, number int, ...) (*github.PullRequestReview, error)
- func GetPR(ctx context.Context, gh *github.Client, owner, repo string, number int) (*github.PullRequest, error)
- func GetPRDiff(ctx context.Context, gh *github.Client, owner, repo string, number int) (string, error)
- func GetPRPatch(ctx context.Context, gh *github.Client, owner, repo string, number int) (string, error)
- func ListPRComments(ctx context.Context, gh *github.Client, owner, repo string, number int) ([]*github.PullRequestComment, error)
- func ListPRFiles(ctx context.Context, gh *github.Client, owner, repo string, number int) ([]*github.CommitFile, error)
- func ListPRReviews(ctx context.Context, gh *github.Client, owner, repo string, number int) ([]*github.PullRequestReview, error)
- func ListPRs(ctx context.Context, gh *github.Client, owner, repo string, ...) ([]*github.PullRequest, error)
- func MergePR(ctx context.Context, gh *github.Client, owner, repo string, number int, ...) (*github.PullRequestMergeResult, error)
- func RequestChangesPR(ctx context.Context, gh *github.Client, owner, repo string, number int, ...) (*github.PullRequestReview, error)
- type MergeableState
- type PRError
- type ReviewEvent
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AddPRReviewers ¶
func AddPRReviewers(ctx context.Context, gh *github.Client, owner, repo string, number int, reviewers, teamReviewers []string) (*github.PullRequest, error)
AddPRReviewers adds reviewers to a pull request.
func ApprovePR ¶ added in v0.7.0
func ApprovePR(ctx context.Context, gh *github.Client, owner, repo string, number int, body string) (*github.PullRequestReview, error)
ApprovePR adds an approval review to a pull request.
func ClosePR ¶
func ClosePR(ctx context.Context, gh *github.Client, owner, repo string, number int) (*github.PullRequest, error)
ClosePR closes a pull request without merging.
func CommentPR ¶ added in v0.7.0
func CommentPR(ctx context.Context, gh *github.Client, owner, repo string, number int, body string) (*github.PullRequestReview, error)
CommentPR adds a comment review to a pull request.
func CreateIssueComment ¶ added in v0.11.0
func CreateIssueComment(ctx context.Context, gh *github.Client, owner, repo string, number int, body string) (*github.IssueComment, error)
CreateIssueComment adds a general comment to a pull request (as an issue comment).
func CreateLineComment ¶ added in v0.11.0
func CreateLineComment(ctx context.Context, gh *github.Client, owner, repo string, number int, commitID, path, body string, line int) (*github.PullRequestComment, error)
CreateLineComment adds a comment on a specific line in a PR diff.
func CreatePR ¶
func CreatePR(ctx context.Context, gh *github.Client, upstreamOwner, upstreamRepo, forkOwner, branch, baseBranch, title, body string) (*github.PullRequest, error)
CreatePR creates a pull request.
func CreateReview ¶ added in v0.11.0
func CreateReview(ctx context.Context, gh *github.Client, owner, repo string, number int, event ReviewEvent, body string) (*github.PullRequestReview, error)
CreateReview creates a pull request review with the specified event type.
func GetPR ¶
func GetPR(ctx context.Context, gh *github.Client, owner, repo string, number int) (*github.PullRequest, error)
GetPR retrieves a pull request by number.
func GetPRDiff ¶ added in v0.11.0
func GetPRDiff(ctx context.Context, gh *github.Client, owner, repo string, number int) (string, error)
GetPRDiff fetches the diff for a pull request.
func GetPRPatch ¶ added in v0.11.0
func GetPRPatch(ctx context.Context, gh *github.Client, owner, repo string, number int) (string, error)
GetPRPatch fetches the patch for a pull request.
func ListPRComments ¶
func ListPRComments(ctx context.Context, gh *github.Client, owner, repo string, number int) ([]*github.PullRequestComment, error)
ListPRComments lists comments on a pull request.
func ListPRFiles ¶
func ListPRFiles(ctx context.Context, gh *github.Client, owner, repo string, number int) ([]*github.CommitFile, error)
ListPRFiles lists files changed in a pull request.
func ListPRReviews ¶ added in v0.7.0
func ListPRReviews(ctx context.Context, gh *github.Client, owner, repo string, number int) ([]*github.PullRequestReview, error)
ListPRReviews lists reviews on a pull request.
func ListPRs ¶
func ListPRs(ctx context.Context, gh *github.Client, owner, repo string, opts *github.PullRequestListOptions) ([]*github.PullRequest, error)
ListPRs lists pull requests for a repository.
Types ¶
type MergeableState ¶ added in v0.7.0
type MergeableState struct {
Mergeable bool
State string // clean, dirty, blocked, behind, unstable, unknown
Message string
}
MergeableState represents the mergeable state of a PR.
func IsMergeable ¶ added in v0.7.0
func IsMergeable(ctx context.Context, gh *github.Client, owner, repo string, number int) (*MergeableState, error)
IsMergeable checks if a PR can be merged and returns detailed status.
type ReviewEvent ¶ added in v0.11.0
type ReviewEvent string
ReviewEvent represents the type of review action.
const ( ReviewEventApprove ReviewEvent = "APPROVE" ReviewEventRequestChanges ReviewEvent = "REQUEST_CHANGES" ReviewEventComment ReviewEvent = "COMMENT" )