...
1 package epics
2
3 import (
4 "github.com/google/go-github/v47/github"
5
6 "edge-infra.dev/pkg/f8n/devinfra/jack/constants"
7
8 "edge-infra.dev/pkg/f8n/devinfra/jack/plugin"
9 )
10
11 func init() {
12 plugin.RegisterIssueHandler(constants.PluginEpics, handleIssue)
13 }
14
15 func handleIssue(hp plugin.HandlerParams, ce github.IssuesEvent) {
16 hp.Log.WithName(constants.PluginEpics)
17
18 log := hp.Log
19 ctx := hp.Ctx
20 client := hp.Client
21
22 switch action := ce.GetAction(); action {
23 case "edited":
24
25 if err := verifyEditedEpic(ctx, log, client, ce); err != nil {
26 log.Error(err, "Error in verifying edited epic")
27 }
28 case "labeled":
29 if err := labelAdded(ctx, log, client, ce); err != nil {
30 log.Error(err, "Error in labelAdded")
31 }
32 case "unlabeled":
33 if err := labelRemoved(ctx, log, client, ce); err != nil {
34 log.Error(err, "Error in labelRemoved")
35 }
36 }
37 }
38
View as plain text