fix: fix event body
Some checks failed
Sample Testing / my_job (push) Failing after 1m47s

This commit is contained in:
Marcel S. Henselin 2026-04-17 13:52:02 +02:00
parent de5dc0d49c
commit 5d2272dc85

16
main.go
View file

@ -143,6 +143,19 @@ func main() {
}
}
func bodyString(s string, d templateData) string {
var buf bytes.Buffer
t, err := template.New("message").Parse(s)
if err != nil {
return ""
}
err = t.Execute(&buf, d)
if err != nil {
return ""
}
return buf.String()
}
func card(d templateData) ([]byte, error) {
switch d.Status {
case "success":
@ -158,7 +171,8 @@ func card(d templateData) ([]byte, error) {
}
if d.EventBody == "" {
d.EventBody = "<b>Project:</b> {{ .Project }}<br><b>Commit-id:</b> <font color=\"#FF0000\">{{ .Commit }}</font><br><b>Branch:</b> <font color=\"#00FF00f\">{{ .Branch }}</font><br><b>Build Status:</b> <font color=\"#0000ff\">{{ .Status }}</font>"
d.EventBody = bodyString("<b>Project:</b> {{ .Project }}<br><b>Commit-id:</b> <font color=\"#FF0000\">{{ .Commit }}</font><br><b>Branch:</b> <font color=\"#00FF00f\">{{ .Branch }}</font><br><b>Build Status:</b> <font color=\"#0000ff\">{{ .Status }}</font>", d)
// d.EventBody = "<b>Project:</b> {{ .Project }}<br><b>Commit-id:</b> <font color=\"#FF0000\">{{ .Commit }}</font><br><b>Branch:</b> <font color=\"#00FF00f\">{{ .Branch }}</font><br><b>Build Status:</b> <font color=\"#0000ff\">{{ .Status }}</font>"
}
if d.Status == "success" {