Help us shape the future of Go! Take the 2026 Go Developer Survey

botutils

package
v0.10.22 Latest Latest
Warning

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

Go to latest
Published: Oct 28, 2019 License: Apache-2.0 Imports: 14 Imported by: 0

README

Botutils

This package contains utilities for writing simple git bot applications.

Implementing hooks

Write a plugin that implements one or more of the handler interfaces defined in interface.go.

Implementing a server

Create an instance of SimpleGitBot:

func Run(ctx context.Context) error {
	staticCfg := botutils.StaticBotConfig{BotName: BotName, Version: version.Version}
	bot := botutils.NewSimpleGitBot(staticCfg)
	return bot.Start(context.TODO(), plugins...)
}

Deploying the bot

The bot needs to be deployed with a config that can be deserialized into the botconfig.Config struct. By default, this should be available at /etc/solo-github-app/config.yml, but can be mounted to a custom location by setting the BOT_CONFIG environment variable.

Documentation

Index

Constants

View Source
const (
	PrType            = "pull_request"
	PrReviewType      = "pull_request_review"
	IssueCommentType  = "issue_comment"
	CommitCommentType = "commit_comment"
	ReleaseType       = "release"
	IssuesType        = "issues"
)

Variables

This section is empty.

Functions

func NewGithubHookHandler

func NewGithubHookHandler(ctx context.Context, clientCreator githubapp.ClientCreator) *githubHookHandler

Types

type CommitCommentHandler

type CommitCommentHandler interface {
	Plugin
	HandleCommitCommentEvent(ctx context.Context, client *github.Client, event *github.CommitCommentEvent) error
}

type GitBot

type GitBot interface {
	Start(ctx context.Context, plugins ...Plugin) error
}

func NewSimpleGitBot

func NewSimpleGitBot(staticConfig StaticBotConfig) (GitBot, error)

type IssueCommentHandler

type IssueCommentHandler interface {
	Plugin
	HandleIssueCommentEvent(ctx context.Context, client *github.Client, event *github.IssueCommentEvent) error
}

type IssuesHandler added in v0.9.7

type IssuesHandler interface {
	Plugin
	HandleIssuesEvent(ctx context.Context, client *github.Client, event *github.IssuesEvent) error
}

type Plugin

type Plugin interface {
}

type PullRequestHandler

type PullRequestHandler interface {
	Plugin
	HandlePREvent(ctx context.Context, client *github.Client, event *github.PullRequestEvent) error
}

type PullRequestReviewHandler

type PullRequestReviewHandler interface {
	Plugin
	HandlePullRequestReviewEvent(ctx context.Context, client *github.Client, event *github.PullRequestReviewEvent) error
}

type Registry

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

func (*Registry) CallCommitCommentPlugins

func (r *Registry) CallCommitCommentPlugins(ctx context.Context, client *github.Client, event *github.CommitCommentEvent)

func (*Registry) CallIssueCommentPlugins

func (r *Registry) CallIssueCommentPlugins(ctx context.Context, client *github.Client, event *github.IssueCommentEvent)

func (*Registry) CallIssuesPlugins added in v0.9.7

func (r *Registry) CallIssuesPlugins(ctx context.Context, client *github.Client, event *github.IssuesEvent)

func (*Registry) CallPrPlugins

func (r *Registry) CallPrPlugins(ctx context.Context, client *github.Client, event *github.PullRequestEvent)

func (*Registry) CallReleasePlugins

func (r *Registry) CallReleasePlugins(ctx context.Context, client *github.Client, event *github.ReleaseEvent)

func (*Registry) PullRequestReviewPlugins

func (r *Registry) PullRequestReviewPlugins(ctx context.Context, client *github.Client, event *github.PullRequestReviewEvent)

func (*Registry) RegisterPlugin

func (r *Registry) RegisterPlugin(p Plugin)

type ReleaseHandler

type ReleaseHandler interface {
	Plugin
	HandleReleaseEvent(ctx context.Context, client *github.Client, event *github.ReleaseEvent) error
}

type StaticBotConfig

type StaticBotConfig struct {
	BotName string
	Version string
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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