Skip to content

Instantly share code, notes, and snippets.

@nzlosh
Created February 27, 2019 08:56
Show Gist options
  • Save nzlosh/375631a06536faa1a85056b90a908326 to your computer and use it in GitHub Desktop.
Save nzlosh/375631a06536faa1a85056b90a908326 to your computer and use it in GitHub Desktop.
---
name: conditional_action
pack: test
description: "Executes the action based on run_action parameter."
runner_type: orquesta
entry_point: workflow/conditional_action.yaml
enabled: True
parameters:
run_action:
required: true
type: string
default: "action1"
---
version: 1.0
description: "Executes the action based on run_action parameter."
input:
- run_action
tasks:
select_action:
action: core.noop
next:
-
when: <% ctx("run_action") = "action1" %>
do: action1
-
when: <% ctx("run_action") = "action2" %>
do: action2
-
when: <% not ctx("run_action") in ["action1", "action2"] %>
do: error
action1:
action: core.local
input:
cmd: echo "You have run action1"
action2:
action: core.local
input:
cmd: echo "You have run action2"
error:
action: core.local
input:
cmd: echo "Error - unsupported action"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment