library for generating templates in drone plugin developing
Official Golang Library is used, if you are not familiar with that, please visit https://godoc.org/text/template
import (
"github.com/f1shl3gs/drone-template"
)
func YourFunction() {
key, err := template.Execute("the repo name is {{ .Repo.Name }}")
// handle error
// do something
}
date
: convert unix timestamp to date, timezone(eg: 'Asia/Shanghai') and format is optional- timestamp: required, unix second
- timezone: optional, eg: 'Asia/Shanghai'
- format: optional, if
format
specified, timezone become required, empty value equal to "Local"
now
: generate a date string of now- timezone: optional, eg: 'Asia/Shanghai'
- format: optional, if
format
specified, timezone become required, empty value equal to "Local"
line break might break json format(drone-plugins/drone-webhook#34),
you can fix it by quote
which is a built-in function of text/template