woodpecker/pkg/yaml/parse.go

16 lines
319 B
Go
Raw Normal View History

package parser
import (
"github.com/drone/drone/pkg/types"
2015-05-22 18:37:40 +00:00
"github.com/drone/drone/Godeps/_workspace/src/gopkg.in/yaml.v2"
)
func ParseCondition(raw string) (*types.Condition, error) {
2015-04-30 17:39:16 +00:00
c := struct {
Condition *types.Condition `yaml:"when"`
2015-04-30 17:39:16 +00:00
}{}
err := yaml.Unmarshal([]byte(raw), c)
return c.Condition, err
}