|
@@ -14,15 +14,15 @@ type githubRepository struct {
|
14
|
14
|
}
|
15
|
15
|
|
16
|
16
|
type githubRelease struct {
|
17
|
|
- Html_url string
|
18
|
|
- Tag_name string
|
19
|
|
- Name string
|
|
17
|
+ Html_url string
|
|
18
|
+ Tag_name string
|
|
19
|
+ Name string
|
20
|
20
|
}
|
21
|
21
|
|
22
|
22
|
type githubPayload struct {
|
23
|
|
- Action string
|
24
|
|
- Release githubRelease
|
25
|
|
- Repository githubRepository
|
|
23
|
+ Action string
|
|
24
|
+ Release githubRelease
|
|
25
|
+ Repository githubRepository
|
26
|
26
|
}
|
27
|
27
|
|
28
|
28
|
func (hl *HTTPListener) githubReleasesHandler(w http.ResponseWriter, request *http.Request) {
|
|
@@ -35,7 +35,7 @@ func (hl *HTTPListener) githubReleasesHandler(w http.ResponseWriter, request *ht
|
35
|
35
|
buf := new(bytes.Buffer)
|
36
|
36
|
buf.ReadFrom(request.Body)
|
37
|
37
|
json.Unmarshal(buf.Bytes(), &payload)
|
38
|
|
-
|
|
38
|
+
|
39
|
39
|
if payload.Action == "published" {
|
40
|
40
|
name := payload.Repository.Description
|
41
|
41
|
if name == "" {
|
|
@@ -45,7 +45,7 @@ func (hl *HTTPListener) githubReleasesHandler(w http.ResponseWriter, request *ht
|
45
|
45
|
if release == "" {
|
46
|
46
|
release = payload.Release.Tag_name
|
47
|
47
|
}
|
48
|
|
-
|
|
48
|
+
|
49
|
49
|
msg := fmt.Sprintf("[\x02Release\x0f] \x02%s\x0f version \x02%s\x0f has been published: %s", name, release, payload.Release.Html_url)
|
50
|
50
|
|
51
|
51
|
channelKey := fmt.Sprintf("http.listeners.github-releases.%s", payload.Repository.Name)
|