mirror of
https://github.com/woodpecker-ci/woodpecker.git
synced 2024-11-23 02:11:01 +00:00
Fix branch condition on tags (#917)
* Fix branch condition on tags * Add docs * Update docs/docs/20-usage/20-pipeline-syntax.md Co-authored-by: Anbraten <anton@ju60.de>
This commit is contained in:
parent
70af29f9a2
commit
687d57217d
2 changed files with 7 additions and 1 deletions
|
@ -302,6 +302,10 @@ Example conditional execution by repository:
|
|||
|
||||
#### `branch`
|
||||
|
||||
:::note
|
||||
Branch conditions are not applied to tags.
|
||||
:::
|
||||
|
||||
Example conditional execution by branch:
|
||||
|
||||
```diff
|
||||
|
|
|
@ -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
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue