added action to conditionals

This commit is contained in:
Brad Rydzewski 2019-07-29 20:37:04 -07:00
parent 801212a923
commit e1a16634b6
4 changed files with 9 additions and 0 deletions

View file

@ -8,6 +8,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
### Added
- disable github status for cron jobs
- support for action in conditionals, by [@bradrydzewski](https://github.com/bradrydzewski). [#2685](https://github.com/drone/drone/issues/2685).
### Fixed

View file

@ -260,6 +260,7 @@ func (r *Runner) Run(ctx context.Context, id int64) error {
)
comp.SkipFunc = compiler.SkipFunc(
compiler.SkipData{
Action: m.Build.Action,
Branch: m.Build.Target,
Cron: m.Build.Cron,
Event: m.Build.Event,

View file

@ -33,6 +33,10 @@ func skipEvent(document *yaml.Pipeline, event string) bool {
return !document.Trigger.Event.Match(event)
}
func skipAction(document *yaml.Pipeline, action string) bool {
return !document.Trigger.Action.Match(action)
}
func skipInstance(document *yaml.Pipeline, instance string) bool {
return !document.Trigger.Instance.Match(instance)
}

View file

@ -259,6 +259,9 @@ func (t *triggerer) Trigger(ctx context.Context, repo *core.Repository, base *co
} else if skipEvent(pipeline, base.Event) {
logger = logger.WithField("pipeline", pipeline.Name)
logger.Infoln("trigger: skipping pipeline, does not match event")
} else if skipAction(pipeline, base.Action) {
logger = logger.WithField("pipeline", pipeline.Name)
logger.Infoln("trigger: skipping pipeline, does not match action")
} else if skipRef(pipeline, base.Ref) {
logger = logger.WithField("pipeline", pipeline.Name)
logger.Infoln("trigger: skipping pipeline, does not match ref")