package project import ( "fmt" "github.com/google/go-github/v47/github" "edge-infra.dev/pkg/f8n/devinfra/jack/constants" "edge-infra.dev/pkg/f8n/devinfra/jack/plugin" ) func init() { plugin.RegisterIssueHandler(constants.PluginProject, handleIssue) } func handleIssue(hp plugin.HandlerParams, ce github.IssuesEvent) { hp.Log.WithName(constants.PluginProject) switch action := ce.GetAction(); action { case "opened": hp.Log.Info("Running project plugin") executeNewIssue(hp, ce) } } func executeNewIssue(hp plugin.HandlerParams, ce github.IssuesEvent) { // add issue to each project ids := hp.Params.Project.IDs for _, id := range ids { hp.Log.Info(fmt.Sprintf("attempting to create a new issue for project #%d", id)) err := addIssueToProject(hp, ce, id) if err != nil { hp.Log.Error(err, "Failed to add issue to project") } } }