-
Notifications
You must be signed in to change notification settings - Fork 1
/
issues.go
37 lines (32 loc) · 826 Bytes
/
issues.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
package main
import "fmt"
type githubissuehandler struct{}
func (g *githubissuehandler) handleIssueEvent(data issuehook) (messages []string) {
switch data.Action {
case "opened":
return g.handleIssueOpened(data)
case "closed":
return g.handleIssueClosed(data)
}
return []string{}
}
func (g *githubissuehandler) handleIssueOpened(data issuehook) (messages []string) {
messages = append(messages, fmt.Sprintf(
"[%s] %s create issue: %s - %s",
data.Repository.FullName,
data.User.Login,
data.Issue.Title,
data.Issue.HtmlURL,
))
return
}
func (g *githubissuehandler) handleIssueClosed(data issuehook) (messages []string) {
messages = append(messages, fmt.Sprintf(
"[%s] %s closed issue %s - %s",
data.Repository.FullName,
data.User.Login,
data.Issue.Title,
data.Issue.HtmlURL,
))
return
}