mirror of
https://github.com/thegeeklab/drone-yaml.git
synced 2024-11-21 17:40:39 +00:00
added action to when clause
This commit is contained in:
parent
a338c245d7
commit
4889634ea9
@ -6,6 +6,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
||||
|
||||
## [Unreleased]
|
||||
### Added
|
||||
- Added Action field to trigger and when clause, by [@bradrydzewski](https://github.com/bradrydzewski).
|
||||
|
||||
### Fixed
|
||||
|
||||
|
@ -18,6 +18,7 @@ import filepath "github.com/bmatcuk/doublestar"
|
||||
|
||||
// Conditions defines a group of conditions.
|
||||
type Conditions struct {
|
||||
Action Condition `json:"action,omitempty"`
|
||||
Cron Condition `json:"cron,omitempty"`
|
||||
Ref Condition `json:"ref,omitempty"`
|
||||
Repo Condition `json:"repo,omitempty"`
|
||||
|
@ -122,6 +122,9 @@ func printConcurrency(w writer, v yaml.Concurrency) {
|
||||
func printConditions(w writer, name string, v yaml.Conditions) {
|
||||
w.WriteTag(name)
|
||||
w.IndentIncrease()
|
||||
if !isConditionEmpty(v.Action) {
|
||||
printCondition(w, "action", v.Action)
|
||||
}
|
||||
if !isConditionEmpty(v.Branch) {
|
||||
printCondition(w, "branch", v.Branch)
|
||||
}
|
||||
@ -276,7 +279,9 @@ func isConcurrencyEmpty(v yaml.Concurrency) bool {
|
||||
// helper function returns true if the conditions
|
||||
// object is empty.
|
||||
func isConditionsEmpty(v yaml.Conditions) bool {
|
||||
return isConditionEmpty(v.Branch) &&
|
||||
return isConditionEmpty(v.Action) &&
|
||||
isConditionEmpty(v.Branch) &&
|
||||
isConditionEmpty(v.Cron) &&
|
||||
isConditionEmpty(v.Event) &&
|
||||
isConditionEmpty(v.Instance) &&
|
||||
isConditionEmpty(v.Paths) &&
|
||||
|
Loading…
Reference in New Issue
Block a user