Adjust template as 'GroupKey' is not what I expected it to be
continuous-integration/drone/push Build is passing Details
continuous-integration/drone/tag Build is passing Details

This commit is contained in:
Luca 2023-03-09 18:42:21 +01:00
parent 67b4407a9b
commit e3e06a8aba
1 changed files with 2 additions and 3 deletions

View File

@ -11,14 +11,13 @@ import (
const ( const (
messageTemplate = "\U0001f6a8" + messageTemplate = "\U0001f6a8" +
` **Alerts for group "_{{ .GroupKey }}_":**{{ range .Alerts }} ` **New alerts:** @room{{ range .Alerts }}
` + "\u2022" + ` {{ if eq .Status "` + StatusResolved + `" }}` + "\u2705" + ` + "\u2022" + ` {{ if eq .Status "` + StatusResolved + `" }}` + "\u2705" +
`{{ else }}{{ with .Labels.severity }}{{ if eq . "critical" }}` + "\U0001f525" + `{{ else }}{{ with .Labels.severity }}{{ if eq . "critical" }}` + "\U0001f525" +
`{{ else if eq . "warning" }}` + "\U0001f4e2" + `{{ else if eq . "warning" }}` + "\U0001f4e2" +
`{{ else }}` + "\U0001f514" + `{{ else }}` + "\U0001f514" +
`{{ end }}{{ else }}` + "\U0001f514" + `{{ end }}{{ else }}` + "\U0001f514" +
`{{ end }}{{ end }} {{ .Annotations.description }}{{ end }} `{{ end }}{{ end }} {{ .Annotations.description }}{{ end }}`
@room`
) )
func (s Server) handleWebhook(w http.ResponseWriter, r *http.Request) { func (s Server) handleWebhook(w http.ResponseWriter, r *http.Request) {