diff --git a/CHANGELOG.md b/CHANGELOG.md index a3197023..d7966c01 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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 diff --git a/operator/runner/runner.go b/operator/runner/runner.go index eb85e99b..a247e819 100644 --- a/operator/runner/runner.go +++ b/operator/runner/runner.go @@ -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, diff --git a/trigger/skip.go b/trigger/skip.go index f211acb0..eedd8e24 100644 --- a/trigger/skip.go +++ b/trigger/skip.go @@ -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) } diff --git a/trigger/trigger.go b/trigger/trigger.go index 4fe88f06..1fe55c7e 100644 --- a/trigger/trigger.go +++ b/trigger/trigger.go @@ -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")