You've already forked woodpecker
mirror of
https://github.com/woodpecker-ci/woodpecker.git
synced 2025-11-29 21:48:14 +02:00
Setting for empty commits on path condition (#3708)
This commit is contained in:
@@ -69,7 +69,8 @@ type (
|
||||
Path struct {
|
||||
Include []string
|
||||
Exclude []string
|
||||
IgnoreMessage string `yaml:"ignore_message,omitempty"`
|
||||
IgnoreMessage string `yaml:"ignore_message,omitempty"`
|
||||
OnEmpty yamlBaseTypes.BoolTrue `yaml:"on_empty,omitempty"`
|
||||
}
|
||||
)
|
||||
|
||||
@@ -331,6 +332,7 @@ func (c *Path) UnmarshalYAML(value *yaml.Node) error {
|
||||
Include yamlBaseTypes.StringOrSlice `yaml:"include,omitempty"`
|
||||
Exclude yamlBaseTypes.StringOrSlice `yaml:"exclude,omitempty"`
|
||||
IgnoreMessage string `yaml:"ignore_message,omitempty"`
|
||||
OnEmpty yamlBaseTypes.BoolTrue `yaml:"on_empty,omitempty"`
|
||||
}{}
|
||||
|
||||
var out2 yamlBaseTypes.StringOrSlice
|
||||
@@ -340,6 +342,7 @@ func (c *Path) UnmarshalYAML(value *yaml.Node) error {
|
||||
|
||||
c.Exclude = out1.Exclude
|
||||
c.IgnoreMessage = out1.IgnoreMessage
|
||||
c.OnEmpty = out1.OnEmpty
|
||||
c.Include = append( //nolint:gocritic
|
||||
out1.Include,
|
||||
out2...,
|
||||
@@ -361,9 +364,9 @@ func (c *Path) Match(v []string, message string) bool {
|
||||
return true
|
||||
}
|
||||
|
||||
// always match if there are no commit files (empty commit)
|
||||
// return value based on 'on_empty', if there are no commit files (empty commit)
|
||||
if len(v) == 0 {
|
||||
return true
|
||||
return c.OnEmpty.Bool()
|
||||
}
|
||||
|
||||
if len(c.Exclude) > 0 && c.Excludes(v) {
|
||||
|
||||
Reference in New Issue
Block a user