mirror of
https://github.com/woodpecker-ci/woodpecker.git
synced 2024-12-24 17:30:30 +00:00
18 lines
412 B
Go
18 lines
412 B
Go
package yaml
|
|
|
|
import "gopkg.in/yaml.v2"
|
|
|
|
// ParseBranch parses the branch section of the Yaml document.
|
|
func ParseBranch(in []byte) Constraint {
|
|
out := struct {
|
|
Constraint Constraint `yaml:"branches"`
|
|
}{}
|
|
|
|
yaml.Unmarshal(in, &out)
|
|
return out.Constraint
|
|
}
|
|
|
|
// ParseBranchString parses the branch section of the Yaml document.
|
|
func ParseBranchString(in string) Constraint {
|
|
return ParseBranch([]byte(in))
|
|
}
|