api

package
v1.6.2 Latest Latest
Warning

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

Go to latest
Published: Aug 12, 2020 License: MIT Imports: 12 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Commenter added in v1.1.0

type Commenter interface {
	Create(ctx context.Context, cmt comment.Comment) error
}

Commenter is API to post a comment to GitHub

type ExecCommentParams added in v1.1.0

type ExecCommentParams struct {
	Stdout         string
	Stderr         string
	CombinedOutput string
	Command        string
	JoinCommand    string
	ExitCode       int
	Env            func(string) string
	// PRNumber is the pull request number where the comment is posted
	PRNumber int
	// Org is the GitHub Organization or User name
	Org string
	// Repo is the GitHub Repository name
	Repo string
	// SHA1 is the commit SHA1
	SHA1        string
	TemplateKey string
	Template    string
	Vars        map[string]interface{}
}

type ExecController added in v1.1.0

type ExecController struct {
	Wd        string
	Stdin     io.Reader
	Stdout    io.Writer
	Stderr    io.Writer
	Getenv    func(string) string
	Reader    Reader
	Commenter Commenter
	Renderer  Renderer
	Executor  Executor
	Expr      Expr
	Platform  platform.Platform
}

func (ExecController) Exec added in v1.1.0

func (ctrl ExecController) Exec(ctx context.Context, opts option.ExecOptions) error

type Executor added in v1.1.0

type Executor interface {
	Run(ctx context.Context, params execute.Params) (execute.Result, error)
}

type Expr added in v1.1.0

type Expr interface {
	Match(expression string, params interface{}) (bool, error)
}

type Fsys added in v1.4.0

type Fsys interface {
	Exist(string) bool
	Write(path string, content []byte) error
}

type InitController added in v1.4.0

type InitController struct {
	Fsys Fsys
}

func (InitController) Run added in v1.4.0

func (ctrl InitController) Run(ctx context.Context) error

type PostController added in v1.1.0

type PostController struct {
	// Wd is a path to the working directory
	Wd string
	// Getenv returns the environment variable. os.Getenv
	Getenv func(string) string
	// HasStdin returns true if there is the standard input
	// If thre is the standard input, it is treated as the comment template
	HasStdin  func() bool
	Stdin     io.Reader
	Reader    Reader
	Commenter Commenter
	Renderer  Renderer
	Platform  platform.Platform
}

func (PostController) Post added in v1.1.0

func (ctrl PostController) Post(ctx context.Context, opts option.PostOptions) error

type PostTemplateParams

type PostTemplateParams struct {
	// PRNumber is the pull request number where the comment is posted
	PRNumber int
	// Org is the GitHub Organization or User name
	Org string
	// Repo is the GitHub Repository name
	Repo string
	// SHA1 is the commit SHA1
	SHA1        string
	TemplateKey string
	Vars        map[string]interface{}
}

type Reader added in v1.1.0

type Reader interface {
	FindAndRead(cfgPath, wd string) (config.Config, error)
}

Reader is API to find and read the configuration file of github-comment

type Renderer added in v1.1.0

type Renderer interface {
	Render(tpl string, templates map[string]string, params interface{}) (string, error)
}

Jump to

Keyboard shortcuts

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