Skip to content

Instantly share code, notes, and snippets.

@mszostok
Last active January 24, 2023 14:15
package main
import (
"context"
"github.com/hashicorp/go-plugin"
"github.com/kubeshop/botkube/pkg/api"
"github.com/kubeshop/botkube/pkg/api/executor"
)
const (
pluginName = "gh"
)
// GHExecutor implements the Botkube executor plugin interface.
type GHExecutor struct{}
// Metadata returns details about the GitHub plugin.
func (*GHExecutor) Metadata(context.Context) (api.MetadataOutput, error) {
return api.MetadataOutput{
Version: "v1.0.0",
Description: "GH creates an issue on GitHub for a related Kubernetes resource.",
}, nil
}
// Execute returns a given command as a response.
func (e *GHExecutor) Execute(ctx context.Context, in executor.ExecuteInput) (executor.ExecuteOutput, error) {
return executor.ExecuteOutput{
Data: "Aloha! 🏄",
}, nil
}
func main() {
executor.Serve(map[string]plugin.Plugin{
pluginName: &executor.Plugin{
Executor: &GHExecutor{},
},
})
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment