github

package
v0.0.0-...-9c33426 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Command

type Command int
const (
	ForkAndClone Command = iota
	Clone
	CreatePullRequest
	ClosePullRequest
	GetDefaultBranchName
	UpdatePRDescription
)

type FakeGitHub

type FakeGitHub struct {
	// contains filtered or unexported fields
}

func NewAlwaysFailsFakeGitHub

func NewAlwaysFailsFakeGitHub() *FakeGitHub

func NewAlwaysFailsOnGetDefaultBranchFakeGitHub

func NewAlwaysFailsOnGetDefaultBranchFakeGitHub() *FakeGitHub

func NewAlwaysReturnsFalseFakeGitHub

func NewAlwaysReturnsFalseFakeGitHub() *FakeGitHub

func NewAlwaysSucceedsFakeGitHub

func NewAlwaysSucceedsFakeGitHub() *FakeGitHub

func NewAlwaysThrowNoPRFound

func NewAlwaysThrowNoPRFound() *FakeGitHub

func NewFakeGitHub

func NewFakeGitHub(h func(command Command, args []string) (bool, error), r func(workingDir string) (interface{}, error)) *FakeGitHub

func (*FakeGitHub) AssertCalledWith

func (f *FakeGitHub) AssertCalledWith(t *testing.T, expected [][]string)

func (*FakeGitHub) Clone

func (f *FakeGitHub) Clone(_ io.Writer, workingDir string, fullRepoName string) error

func (*FakeGitHub) ClosePullRequest

func (f *FakeGitHub) ClosePullRequest(_ io.Writer, workingDir string, branchName string) error

func (*FakeGitHub) CreatePullRequest

func (f *FakeGitHub) CreatePullRequest(_ io.Writer, workingDir string, metadata PullRequest) (didCreate bool, err error)

func (*FakeGitHub) ForkAndClone

func (f *FakeGitHub) ForkAndClone(_ io.Writer, workingDir string, fullRepoName string) error

func (*FakeGitHub) GetDefaultBranchName

func (f *FakeGitHub) GetDefaultBranchName(_ io.Writer, workingDir string, fullRepoName string) (string, error)

func (*FakeGitHub) GetPR

func (f *FakeGitHub) GetPR(_ io.Writer, workingDir string, _ string) (*PrStatus, error)

func (*FakeGitHub) UpdatePRDescription

func (f *FakeGitHub) UpdatePRDescription(_ io.Writer, workingDir string, title string, body string) error

type GitHub

type GitHub interface {
	ForkAndClone(output io.Writer, workingDir string, fullRepoName string) error
	Clone(output io.Writer, workingDir string, fullRepoName string) error
	CreatePullRequest(output io.Writer, workingDir string, metadata PullRequest) (didCreate bool, err error)
	ClosePullRequest(output io.Writer, workingDir string, branchName string) error
	UpdatePRDescription(output io.Writer, workingDir string, title string, body string) error
	GetPR(output io.Writer, workingDir string, branchName string) (*PrStatus, error)
	GetDefaultBranchName(output io.Writer, workingDir string, fullRepoName string) (string, error)
}

type NoPRFoundError

type NoPRFoundError struct {
	Path       string
	BranchName string
}

GetPR is a helper function to retrieve the PR associated with the branch Name

func (*NoPRFoundError) Error

func (e *NoPRFoundError) Error() string

type PrStatus

type PrStatus struct {
	Closed         bool            `json:"closed"`
	HeadRefName    string          `json:"headRefName"`
	Mergeable      string          `json:"mergeable"`
	Number         int             `json:"number"`
	ReactionGroups []ReactionGroup `json:"reactionGroups"`
	ReviewDecision string          `json:"reviewDecision"`
	State          string          `json:"state"`
	Title          string          `json:"title"`
	Url            string          `json:"url"`
}

type PrStatusResponse

type PrStatusResponse struct {
	CurrentBranch *PrStatus   `json:"currentBranch"`
	CreatedBy     []*PrStatus `json:"createdBy"`
	NeedsReview   []*PrStatus `json:"needsReview"`
}

type PullRequest

type PullRequest struct {
	Title          string
	Body           string
	UpstreamRepo   string
	IsDraft        bool
	ReviewDecision string
}

type ReactionGroup

type ReactionGroup struct {
	Content string
	Users   ReactionGroupUsers
}

type ReactionGroupUsers

type ReactionGroupUsers struct {
	TotalCount int
}

type RealGitHub

type RealGitHub struct{}

func NewRealGitHub

func NewRealGitHub() *RealGitHub

func (*RealGitHub) Clone

func (r *RealGitHub) Clone(output io.Writer, workingDir string, fullRepoName string) error

func (*RealGitHub) ClosePullRequest

func (r *RealGitHub) ClosePullRequest(output io.Writer, workingDir string, branchName string) error

func (*RealGitHub) CreatePullRequest

func (r *RealGitHub) CreatePullRequest(output io.Writer, workingDir string, pr PullRequest) (didCreate bool, err error)

func (*RealGitHub) ForkAndClone

func (r *RealGitHub) ForkAndClone(output io.Writer, workingDir string, fullRepoName string) error

func (*RealGitHub) GetDefaultBranchName

func (r *RealGitHub) GetDefaultBranchName(output io.Writer, workingDir string, fullRepoName string) (string, error)

func (*RealGitHub) GetPR

func (r *RealGitHub) GetPR(output io.Writer, workingDir string, branchName string) (*PrStatus, error)

func (*RealGitHub) UpdatePRDescription

func (r *RealGitHub) UpdatePRDescription(output io.Writer, workingDir string, title string, body string) error

Jump to

Keyboard shortcuts

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