Compare commits

...

1 Commits

Author SHA1 Message Date
lddsb d0a4fc64e4 feat: support string as a tpl 2021-08-26 09:29:12 +08:00
+5 -4
View File
@@ -25,7 +25,7 @@ type (
RemoteURL string // repo remote url RemoteURL string // repo remote url
} }
// Build build info // Build info
Build struct { Build struct {
Status string // providers the current build status Status string // providers the current build status
Link string // providers the current build link Link string // providers the current build link
@@ -34,7 +34,7 @@ type (
FinishedAt uint64 // build finish at ( unix timestamp ) FinishedAt uint64 // build finish at ( unix timestamp )
} }
// Commit commit info // Commit info
Commit struct { Commit struct {
Branch string // providers the branch for the current commit Branch string // providers the branch for the current commit
Link string // providers the http link to the current commit in the remote source code management system(e.g.GitHub) Link string // providers the http link to the current commit in the remote source code management system(e.g.GitHub)
@@ -120,7 +120,7 @@ type (
Consuming Consuming Consuming Consuming
} }
// Tpl TPL base // Tpl base
Tpl struct { Tpl struct {
Repo TplRepo Repo TplRepo
Commit TplCommit Commit TplCommit
@@ -255,7 +255,8 @@ func (p *Plugin) getTpl() (tpl string, err error) {
tpl = string(body) tpl = string(body)
} else { } else {
if !fileExists(p.Custom.Tpl) { if !fileExists(p.Custom.Tpl) {
return "", errors.New("tpl file not exists") // it must be a tpl stream
return p.Custom.Tpl, nil
} }
tplStr, err := ioutil.ReadFile(p.Custom.Tpl) tplStr, err := ioutil.ReadFile(p.Custom.Tpl)