Documentation
¶
Overview ¶
Package prmergetest is an in-process test double of what a merge reads from and writes to GitHub: a prmerge.GitHub answering from state a test sets, the wait's reads those of prwaittest.GitHub. A merge call merges the pull request: every read after it answers it merged.
Index ¶
- Constants
- func Policy(optedOut bool) prmerge.Policy
- func PullRequest(owner, repo string, number int, sha, author string) *github.PullRequest
- type GitHub
- func (g *GitHub) BehindBy(context.Context, string, string, string, string) (int, error)
- func (g *GitHub) CommitTime(context.Context, string, string, string) (time.Time, error)
- func (g *GitHub) CurrentLogin(context.Context) (string, error)
- func (g *GitHub) DefaultBranch(context.Context, string, string) (string, error)
- func (g *GitHub) DeleteBranch(context.Context, string, string, string) error
- func (g *GitHub) DispatchWorkflow(context.Context, string, string, string, string, map[string]any) error
- func (g *GitHub) EnqueuePullRequest(context.Context, string) error
- func (g *GitHub) IsPullRequest(context.Context, string, string, int) (bool, error)
- func (g *GitHub) IssueComments(context.Context, string, string, int) ([]*github.IssueComment, error)
- func (g *GitHub) MergePullRequest(_ context.Context, _, _ string, _ int, opts githubclient.MergeOptions) (string, error)
- func (g *GitHub) MergeQueueRequired(context.Context, string, string, string) (bool, error)
- func (g *GitHub) Merges() []githubclient.MergeOptions
- func (g *GitHub) OrganizationRuleset(context.Context, string, int64) (*github.RepositoryRuleset, error)
- func (g *GitHub) PullRequest(ctx context.Context, owner, repo string, number int) (*github.PullRequest, error)
- func (g *GitHub) PullRequestReviewComments(context.Context, string, string, int) ([]*github.PullRequestComment, error)
- func (g *GitHub) PullRequestReviews(context.Context, string, string, int) ([]*github.PullRequestReview, error)
- func (g *GitHub) RebasePullRequestBranch(context.Context, string, string) error
- func (g *GitHub) Repository(context.Context, string, string) (*github.Repository, error)
- func (g *GitHub) RepositoryRuleset(context.Context, string, string, int64) (*github.RepositoryRuleset, error)
- func (g *GitHub) RulesForBranch(context.Context, string, string, string) (*github.BranchRules, error)
- func (g *GitHub) UpdatePullRequestBranch(context.Context, string, string, int, string) error
Constants ¶
const Login = "someone"
Login is the login the double's token acts as and its pull requests' author, unless a test says otherwise.
Variables ¶
This section is empty.
Functions ¶
func Policy ¶
Policy is the opt-out of a repository whose team-file entry says agentMerge: false when optedOut, as prmerge.TeamFilePolicy words it.
func PullRequest ¶
func PullRequest(owner, repo string, number int, sha, author string) *github.PullRequest
PullRequest is owner/repo#number, open and clean, its head sha on the branch feature of the same repository, opened by author an hour ago.
Types ¶
type GitHub ¶
type GitHub struct {
*prwaittest.GitHub
// Login is who the token acts as; empty is [Login].
Login string
// MergeCommitSHA is the commit a merge call produces.
MergeCommitSHA string
// Settings are the repository's merge settings; nil allows every
// method.
Settings *github.Repository
// contains filtered or unexported fields
}
GitHub is a prmerge.GitHub over one pull request, PR of the embedded wait double, which a test sets (PullRequest is one).
func New ¶
func New(pr *github.PullRequest, heads ...prwaittest.Head) *GitHub
New is the double of pr, whose head carries heads at each poll.
func (*GitHub) CommitTime ¶
func (*GitHub) DefaultBranch ¶
func (*GitHub) DeleteBranch ¶
func (*GitHub) DispatchWorkflow ¶
func (*GitHub) EnqueuePullRequest ¶
func (*GitHub) IsPullRequest ¶
func (*GitHub) IssueComments ¶
func (*GitHub) MergePullRequest ¶
func (g *GitHub) MergePullRequest(_ context.Context, _, _ string, _ int, opts githubclient.MergeOptions) (string, error)
func (*GitHub) MergeQueueRequired ¶
func (*GitHub) Merges ¶
func (g *GitHub) Merges() []githubclient.MergeOptions
Merges are the merge calls made, in order.
func (*GitHub) OrganizationRuleset ¶
func (*GitHub) PullRequest ¶
func (g *GitHub) PullRequest(ctx context.Context, owner, repo string, number int) (*github.PullRequest, error)
PullRequest is the wait double's pull request, merged once a merge call merged it.