api

package
v0.2.6 Latest Latest
Warning

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

Go to latest
Published: May 22, 2024 License: MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ExecCommentParams

type ExecCommentParams struct {
	Stdout         string
	Stderr         string
	CombinedOutput string
	Command        string
	JoinCommand    string
	ExitCode       int
	// MRNumber is the merge request number where the comment is posted
	MRNumber 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
	UpdateCondition string
	Vars            map[string]interface{}
}

type ExecController

type ExecController struct {
	Wd       string
	Stdin    io.Reader
	Stdout   io.Writer
	Stderr   io.Writer
	Getenv   func(string) string
	Reader   Reader
	GitLab   GitLab
	Renderer Renderer
	Executor Executor
	Expr     Expr
	Platform Platform
	Config   *config.Config
}

func (*ExecController) Exec

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

type Executor

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

type Expr

type Expr interface {
	Match(expression string, params interface{}) (bool, error)
	Compile(expression string) (expr.Program, error)
}

type Fsys

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

type GitLab added in v0.2.1

type GitLab interface {
	CreateComment(note *gitlab.Note) error
	ListNote(mr *gitlab.MergeRequest) ([]*gitlab.Note, error)
	HideComment(nodeID int) error
	MRNumberWithSHA(owner, repo, sha string) (int, error)
}

GitLab is API to post a comment to GitHub

type HideController

type HideController 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
	Stderr   io.Writer
	GitLab   GitLab
	Platform Platform
	Config   *config.Config
	Expr     Expr
}

func (*HideController) Hide

func (ctrl *HideController) Hide(ctx context.Context, opts *option.HideOptions) error

type InitController

type InitController struct {
	Fsys Fsys
}

func (InitController) Run

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

type NoteController

type NoteController struct {
	GitLab   GitLab
	Expr     Expr
	Getenv   func(string) string
	Platform Platform
}

func (*NoteController) Post

func (ctrl *NoteController) Post(ctx context.Context, note *gitlab.Note, hiddenParam map[string]interface{}) error

type ParamListHiddenComments

type ParamListHiddenComments struct {
	Condition string
	HideKey   string
	Org       string
	Repo      string
	SHA1      string
	MRNumber  int
	Vars      map[string]interface{}
}

type Platform

type Platform interface {
	ComplementPost(opts *option.PostOptions) error
	ComplementExec(opts *option.ExecOptions) error
	ComplementHide(opts *option.HideOptions) error
	CI() string
}

type PostController

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
	Stderr   io.Writer
	GitLab   GitLab
	Renderer Renderer
	Platform Platform
	Config   *config.Config
	Expr     Expr
}

func (*PostController) Post

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

type PostTemplateParams

type PostTemplateParams struct {
	// MRNumber is the merge request number where the comment is posted
	MRNumber 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

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

type Renderer

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