gateways

package
v0.0.8 Latest Latest
Warning

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

Go to latest
Published: Feb 20, 2022 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const (
	BaseDir = "/tmp"
)
View Source
const CandidateLabelName = "candidate-template"

Variables

This section is empty.

Functions

This section is empty.

Types

type Git

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

func NewGit

func NewGit(l logr.Logger, e exec.Interface) (*Git, error)

TODO: this impl only support https (ssh is not implemented yet)

func (*Git) CommitAndPush

func (g *Git) CommitAndPush(ctx context.Context, gp GitProject, message string) (*GitProject, error)

func (*Git) CreateFile

func (g *Git) CreateFile(ctx context.Context, gp GitProject, filename string, contents []byte) error

func (*Git) DeleteFile

func (g *Git) DeleteFile(ctx context.Context, gp GitProject, filename string) error

func (*Git) ForceClone

func (g *Git) ForceClone(ctx context.Context, org, repo, branch string) (*GitProject, error)

func (*Git) HashLogs

func (g *Git) HashLogs(ctx context.Context, gp GitProject, hash1, hash2 string) ([]string, error)

func (*Git) WithCredential

func (g *Git) WithCredential(username, token string) error

type GitHub

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

func NewGitHub

func NewGitHub(l logr.Logger) *GitHub

func (*GitHub) CommentToPullRequest

func (g *GitHub) CommentToPullRequest(ctx context.Context, pr PullRequest, comment string) error

func (*GitHub) GetCommitHashes

func (g *GitHub) GetCommitHashes(ctx context.Context, prModel PullRequest) ([]string, error)

func (*GitHub) GetPullRequest added in v0.0.3

func (g *GitHub) GetPullRequest(ctx context.Context, org, repo string, prNum int) (*PullRequest, error)

func (*GitHub) ListOpenPullRequests

func (g *GitHub) ListOpenPullRequests(ctx context.Context, org, repo string) ([]*PullRequest, error)

TODO: 検索条件を指定可能にする (例. label xxx が付与されている PR は対象外)

func (*GitHub) WithCredential

func (g *GitHub) WithCredential(username, token string) error

type GitHubIFace

type GitHubIFace interface {
	WithCredential(username, token string) error
	ListOpenPullRequests(ctx context.Context, org, repo string) ([]*PullRequest, error)
	GetPullRequest(ctx context.Context, org, repo string, prNum int) (*PullRequest, error)
	CommentToPullRequest(ctx context.Context, pr PullRequest, comment string) error
	GetCommitHashes(ctx context.Context, pr PullRequest) ([]string, error)
}

type GitIFace

type GitIFace interface {
	WithCredential(username, token string) error
	ForceClone(ctx context.Context, org, repo, branch string) (*GitProject, error)
	CreateFile(ctx context.Context, gp GitProject, filename string, contents []byte) error
	DeleteFile(ctx context.Context, gp GitProject, filename string) error
	CommitAndPush(ctx context.Context, gp GitProject, message string) (*GitProject, error)
}

type GitProject

type GitProject struct {
	DownloadDir     string
	LatestCommitSha string
}

type PullRequest

type PullRequest struct {
	Organization  string
	Repository    string
	Branch        string
	Number        int
	HeadCommitSha string
	Title         string
	Labels        []string
}

func NewPullRequest

func NewPullRequest(organization, repository, branch string, number int, headCommitSha string, title string, labels []string) *PullRequest

Jump to

Keyboard shortcuts

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