36 lines
878 B
Go
36 lines
878 B
Go
package email
|
|
|
|
import (
|
|
"html/template"
|
|
)
|
|
|
|
// raw email message template
|
|
var rawMessage = `From: %s
|
|
To: %s
|
|
Subject: %s
|
|
MIME-version: 1.0
|
|
Content-Type: text/html; charset="UTF-8"
|
|
|
|
%s`
|
|
|
|
// default success email template
|
|
var successTemplate = template.Must(template.New("_").Parse(`
|
|
<p><b>Build was Successful</b></p>
|
|
<p>Repository : {{.Repo.Owner}}/{{.Repo.Name}}</p>
|
|
<p>Commit : {{.Commit.ShaShort}}</p>
|
|
<p>Author : {{.Commit.Author}}</p>
|
|
<p>Branch : {{.Commit.Branch}}</p>
|
|
<p>Message:</p>
|
|
<p>{{ .Commit.Message }}</p>
|
|
`))
|
|
|
|
// default failure email template
|
|
var failureTemplate = template.Must(template.New("_").Parse(`
|
|
<p><b>Build Failed</b></p>
|
|
<p>Repository : {{.Repo.Owner}}/{{.Repo.Name}}</p>
|
|
<p>Commit : {{.Commit.ShaShort}}</p>
|
|
<p>Author : {{.Commit.Author}}</p>
|
|
<p>Branch : {{.Commit.Branch}}</p>
|
|
<p>Message:</p>
|
|
<p>{{ .Commit.Message }}</p>
|
|
`))
|