diff --git a/docs/docs/20-usage/20-pipeline-syntax.md b/docs/docs/20-usage/20-pipeline-syntax.md index 78836031d..2db15f0b4 100644 --- a/docs/docs/20-usage/20-pipeline-syntax.md +++ b/docs/docs/20-usage/20-pipeline-syntax.md @@ -302,6 +302,10 @@ Example conditional execution by repository: #### `branch` +:::note +Branch conditions are not applied to tags. +::: + Example conditional execution by branch: ```diff diff --git a/pipeline/frontend/yaml/constraint/constraint.go b/pipeline/frontend/yaml/constraint/constraint.go index 64305d926..54af231c6 100644 --- a/pipeline/frontend/yaml/constraint/constraint.go +++ b/pipeline/frontend/yaml/constraint/constraint.go @@ -53,7 +53,6 @@ func (c *Constraints) Match(metadata frontend.Metadata) bool { match := c.Platform.Match(metadata.Sys.Arch) && c.Environment.Match(metadata.Curr.Target) && c.Event.Match(metadata.Curr.Event) && - c.Branch.Match(metadata.Curr.Commit.Branch) && c.Repo.Match(metadata.Repo.Name) && c.Ref.Match(metadata.Curr.Commit.Ref) && c.Instance.Match(metadata.Sys.Host) && @@ -63,6 +62,9 @@ func (c *Constraints) Match(metadata frontend.Metadata) bool { if metadata.Curr.Event == frontend.EventPull || metadata.Curr.Event == frontend.EventPush { match = match && c.Path.Match(metadata.Curr.Commit.ChangedFiles, metadata.Curr.Commit.Message) } + if metadata.Curr.Event != frontend.EventTag { + match = match && c.Branch.Match(metadata.Curr.Commit.Branch) + } return match }