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
- func NewGithubHookHandler(ctx context.Context, clientCreator githubapp.ClientCreator) *githubHookHandler
- type CommitCommentHandler
- type GitBot
- type IssueCommentHandler
- type Plugin
- type PullRequestHandler
- type PullRequestReviewHandler
- type Registry
- func (r *Registry) CallCommitCommentPlugins(ctx context.Context, client *github.Client, event *github.CommitCommentEvent)
- func (r *Registry) CallIssueCommentPlugins(ctx context.Context, client *github.Client, event *github.IssueCommentEvent)
- func (r *Registry) CallPrPlugins(ctx context.Context, client *github.Client, event *github.PullRequestEvent)
- func (r *Registry) CallReleasePlugins(ctx context.Context, client *github.Client, event *github.ReleaseEvent)
- func (r *Registry) PullRequestReviewPlugins(ctx context.Context, client *github.Client, ...)
- func (r *Registry) RegisterPlugin(p Plugin)
- type ReleaseHandler
- type StaticBotConfig
Constants ¶
View Source
const (
PrType = "pull_request"
PrReviewType = "pull_request_review"
IssueCommentType = "issue_comment"
CommitCommentType = "commit_comment"
ReleaseType = "release"
)
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 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) 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
}
Click to show internal directories.
Click to hide internal directories.