diff --git a/examples/main_test.go b/examples/main_test.go index 3120420..a24462a 100644 --- a/examples/main_test.go +++ b/examples/main_test.go @@ -25,8 +25,8 @@ func TestBuildflow(t *testing.T) { //nolint:funlen file: "task_dependency.yaml", }, { - title: "task.when is true", - file: "task_when_true.yaml", + title: "task.when", + file: "task_when.yaml", }, { title: "read_file", diff --git a/examples/task_when.yaml b/examples/task_when.yaml new file mode 100644 index 0000000..f16f6b4 --- /dev/null +++ b/examples/task_when.yaml @@ -0,0 +1,17 @@ +--- +phases: +- name: main + tasks: + - name: "when true" + command: + command: echo "when is always true" + when: true + - name: when + command: + command: echo "use Tengo script in when" + when: | + // Tengo script + // Define the variable "result" and this value should be true or false. + result := func(task) { + return task.Name == "when" + }(Task) diff --git a/examples/task_when_true.yaml b/examples/task_when_true.yaml deleted file mode 100644 index a62bcb4..0000000 --- a/examples/task_when_true.yaml +++ /dev/null @@ -1,8 +0,0 @@ ---- -phases: -- name: main - tasks: - - name: "when true" - command: - command: ":" - when: true