prchecker

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Jan 21, 2019 License: MIT Imports: 16 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DecryptKMS

func DecryptKMS(base64Text string) (string, error)

DecryptKMS decrypts base64 text encrypted by AWS KMS to plain text.

Types

type Assignees

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

Assignees has GitHub users.

func (*Assignees) Add

func (a *Assignees) Add(assignees ...string)

Add adds users into the list.

func (*Assignees) HasAssignees

func (a *Assignees) HasAssignees() bool

HasAssignees checks if at least one user is exists or not.

func (*Assignees) List

func (a *Assignees) List() []string

List returns the list of users.

func (*Assignees) RemoveFromList

func (a *Assignees) RemoveFromList(names ...string)

RemoveFromList removes users from the list.

type Comment

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

Comment contains comments to add to pull request.

func (*Comment) Add

func (c *Comment) Add(s string)

Add adds comment into the list.

func (*Comment) HasComment

func (c *Comment) HasComment() bool

HasComment checks if at least one comment is exists or not.

func (*Comment) Show

func (c *Comment) Show() string

Show gets joined comment.

type Config

type Config struct {
	RepositoryList map[string]*Repository `yaml:"repository"`
	APIToken       string                 `yaml:"api_token"`
	APITokenKMS    string                 `yaml:"api_token_kms"`
	BotID          int64                  `yaml:"bot_id"`
	WebHookSecret  string                 `yaml:"webhook_secret"`
	// If `AddComment` is true, comment is created each push event.
	// If `AddComment` is false, comment is edited each push event.
	AddComment bool `yaml:"add_comment"`

	Timeout time.Duration `yaml:"timeout"`
}

Config contains settings.

func NewConfig

func NewConfig() (Config, error)

NewConfig creates Config from yaml file and environment paramter.

func (Config) GetAPIToken

func (c Config) GetAPIToken() string

GetAPIToken gets api token for GitHub.

func (Config) GetRepository

func (c Config) GetRepository(name string) *Repository

GetRepository gets Repository setting to manage pull request.

func (Config) HasAPIToken

func (c Config) HasAPIToken() bool

HasAPIToken checks if api token is exists or not.

func (*Config) Init

func (c *Config) Init() error

Init initializes config.

type File

type File struct {
	Name   string   `yaml:"name"`
	Regexp []string `yaml:"regexp"`

	Comment   string   `yaml:"comment"`
	Assignees []string `yaml:"assignees"`
	Reviewers []string `yaml:"reviewers"`
	ShowFiles bool     `yaml:"show_files"`
	// contains filtered or unexported fields
}

File has rules to check changed file and manage comment/assignees/reviwers of pull request.

func (*File) GetComment

func (f *File) GetComment(files []string) string

GetComment gets comment.

func (*File) Init

func (f *File) Init()

Init initializes regexp rules.

func (*File) Match

func (f *File) Match(path string) bool

Match checks file path matches the regexp rule or not..

type Repository

type Repository struct {
	Files []*File
}

Repository has settings to check changed files.

func (*Repository) Init

func (r *Repository) Init()

Init initializes all of Files.

type WebhookHandler

type WebhookHandler struct {
	Config Config
	// contains filtered or unexported fields
}

WebhookHandler handles webhook request.

func New

func New() (*WebhookHandler, error)

New creates WebhookHandler from environment params.

func NewWithConfig

func NewWithConfig(conf Config) (*WebhookHandler, error)

NewWithConfig creates WebhookHandler from given Config.

func (*WebhookHandler) HandleRequest

func (h *WebhookHandler) HandleRequest(r *http.Request) error

HandleRequest handles webhook request and run PullRequestChecker.

Jump to

Keyboard shortcuts

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