repository

package
v0.0.0-...-d956a41 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Validate

func Validate(typ string, cfg map[string]interface{}) error

Types

type File

type File interface {
	// May return nil.
	Content() []byte
	Path() string
	SHA() string
}

type GitHub

type GitHub struct {
	githubutil.GitHubOptions `cfg:",squash"`

	Owner      string `cfg:"owner" validate:"required"`
	Repo       string `cfg:"repo" validate:"required"`
	BaseBranch string `cfg:"base_branch"`

	Labels []string `cfg:"labels"`

	CommitterName  string `cfg:"committer_name"`
	CommitterEmail string `cfg:"committer_email" validate:"required_with=CommitterName"`
	// contains filtered or unexported fields
}

func (*GitHub) AddPRComment

func (gh *GitHub) AddPRComment(pr PullRequest, body string) error

AddPRComment implements Repository

func (*GitHub) ClosePR

func (gh *GitHub) ClosePR(pr PullRequest) error

ClosePR implements Repository

func (*GitHub) DeletePRBranch

func (gh *GitHub) DeletePRBranch(prID string) (string, error)

DeletePRBranch implements Repository

func (*GitHub) FindPR

func (gh *GitHub) FindPR(s string) (PullRequest, error)

FindPR implements Repository

func (*GitHub) GetFile

func (gh *GitHub) GetFile(path string) (File, error)

GetFile implements Repository

func (*GitHub) RebasePR

func (gh *GitHub) RebasePR(pr PullRequest, path string, oldSHA string, newContent []byte, commitMsg string) error

RebasePR implements Repository

func (*GitHub) UpdateFilePR

func (gh *GitHub) UpdateFilePR(path string, oldSHA string, newContent []byte, commitMsg string, newBranch string, prTitle string, prBody string) (prID string, err error)

UpdateFilePR implements Repository

type GitHubFile

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

func (*GitHubFile) Content

func (f *GitHubFile) Content() []byte

Content implements File

func (*GitHubFile) Path

func (f *GitHubFile) Path() string

Path implements File

func (*GitHubFile) SHA

func (f *GitHubFile) SHA() string

SHA implements File

type GitHubPR

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

func (*GitHubPR) Body

func (pr *GitHubPR) Body() string

Body implements PullRequest

func (*GitHubPR) ID

func (pr *GitHubPR) ID() string

ID implements PullRequest

func (*GitHubPR) IsMergeable

func (pr *GitHubPR) IsMergeable() bool

IsMergeable implements PullRequest

func (*GitHubPR) IsOpen

func (pr *GitHubPR) IsOpen() bool

IsOpen implements PullRequest

type Gitea

type Gitea struct {
	giteautil.ClientOptions `cfg:",squash"`

	CommitterName  string `cfg:"committer_name"`
	CommitterEmail string `cfg:"committer_email" validate:"required_with=CommitterName"`

	Labels []string `cfg:"labels"`

	Owner      string `cfg:"owner" validate:"required"`
	Repo       string `cfg:"repo" validate:"required"`
	BaseBranch string `cfg:"base_branch"`
	PageSize   int    `cfg:"page_size"`
	// contains filtered or unexported fields
}

func (*Gitea) AddPRComment

func (g *Gitea) AddPRComment(pr PullRequest, body string) error

AddPRComment implements Repository

func (*Gitea) ClosePR

func (g *Gitea) ClosePR(pr PullRequest) error

ClosePR implements Repository

func (*Gitea) DeletePRBranch

func (g *Gitea) DeletePRBranch(prID string) (string, error)

DeletePRBranch implements Repository

func (*Gitea) FindPR

func (g *Gitea) FindPR(s string) (PullRequest, error)

FindPR implements Repository

func (*Gitea) GetFile

func (g *Gitea) GetFile(path string) (File, error)

GetFile implements Repository

func (*Gitea) RebasePR

func (g *Gitea) RebasePR(pr PullRequest, path string, oldSHA string, newContent []byte, commitMsg string) error

RebasePR implements Repository

Updates the file by creating a new PR based on this one since Gitea doesn't have an API for git references.

func (*Gitea) UpdateFilePR

func (g *Gitea) UpdateFilePR(path string, oldSHA string, newContent []byte, commitMsg string, newBranch string, prTitle string, prBody string) (prID string, err error)

UpdateFilePR implements Repository

type GiteaFile

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

func (*GiteaFile) Content

func (f *GiteaFile) Content() []byte

Content implements File

func (*GiteaFile) Path

func (f *GiteaFile) Path() string

Path implements File

func (*GiteaFile) SHA

func (f *GiteaFile) SHA() string

SHA implements File

type GiteaPR

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

func (*GiteaPR) Body

func (pr *GiteaPR) Body() string

Body implements PullRequest

func (*GiteaPR) ID

func (pr *GiteaPR) ID() string

ID implements PullRequest

func (*GiteaPR) IsMergeable

func (pr *GiteaPR) IsMergeable() bool

IsMergeable implements PullRequest

func (*GiteaPR) IsOpen

func (pr *GiteaPR) IsOpen() bool

IsOpen implements PullRequest

type PullRequest

type PullRequest interface {
	ID() string
	Body() string
	IsOpen() bool
	IsMergeable() bool
}

type Repository

type Repository interface {
	GetFile(path string) (File, error)
	FindPR(string) (PullRequest, error)
	UpdateFilePR(path string, oldSHA string, newContent []byte, commitMsg string, newBranch string, prTitle string, prBody string) (prID string, err error)
	// Implementations can assume that pr is their own PR type.
	ClosePR(pr PullRequest) error
	AddPRComment(pr PullRequest, body string) error
	RebasePR(pr PullRequest, path string, oldSHA string, newContent []byte, commitMsg string) error
	// Return the name of the deleted branch.
	DeletePRBranch(prID string) (string, error)
}

func NewRepository

func NewRepository(typ string, cfg map[string]interface{}) (Repository, error)

Jump to

Keyboard shortcuts

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