Documentation
¶
Index ¶
- func Ptr[T any](t T) *T
- func ServePlugin(p Plugin)
- type Base
- func (p Base) Apply(ctx Context) error
- func (p Base) Filter(ctx Context) (bool, error)
- func (p Base) Init(config map[string]string) error
- func (p Base) OnPrClosed(ctx Context) error
- func (p Base) OnPrCreated(ctx Context) error
- func (p Base) OnPrMerged(ctx Context) error
- func (p Base) Shutdown() error
- type Context
- type Plugin
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ServePlugin ¶
func ServePlugin(p Plugin)
ServePlugin starts the go-plugin process and serves the plugin.
Types ¶
type Base ¶
type Base struct{}
Base is a base implementation of Plugin. Plugin authors can embed this struct to implement only those methods of Plugin they need.
type ExamplePlugin struct {
plugin.Base
}
func (Base) OnPrCreated ¶
OnPrCreated implements Plugin.
type Context ¶
type Context struct {
*protocolv1.Context
}
Context contains data on which repository to process.
type Plugin ¶
type Plugin interface {
// Apply executes code that modifies the content of a repository.
Apply(ctx Context) error
// Filter decides if the plugin should modify contents in a repository.
// It is executed before Apply.
Filter(ctx Context) (bool, error)
// Init is called once after Ganvil started the plugin.
// config contains configuration values set in the task file.
Init(config map[string]string) error
// Name returns the name of the plugin.
Name() string
// OnPrClosed executes code when Ganvil closes a pull request.
OnPrClosed(ctx Context) error
// OnPrCreated executes code when Ganvil creates a pull request.
OnPrCreated(ctx Context) error
// OnPrMerged executes code when Ganvil merges a pull request.
OnPrMerged(ctx Context) error
// Shutdown is called once right before Ganvil shuts down the plugin.
// It can execute code to free allocated resources or close connections.
Shutdown() error
}
Plugin defines all methods that a Go plugin must implement.
Click to show internal directories.
Click to hide internal directories.