From eb66ee9dfe7b8efb33eba462ec769cb5d499f905 Mon Sep 17 00:00:00 2001 From: vilmibm Date: Mon, 12 Apr 2021 12:05:05 -0500 Subject: [PATCH] handle array type for on: in workflow file --- pkg/cmd/workflow/run/run.go | 7 +++++++ pkg/cmd/workflow/run/run_test.go | 5 +++++ 2 files changed, 12 insertions(+) diff --git a/pkg/cmd/workflow/run/run.go b/pkg/cmd/workflow/run/run.go index 18448990d..6e732cb69 100644 --- a/pkg/cmd/workflow/run/run.go +++ b/pkg/cmd/workflow/run/run.go @@ -369,6 +369,13 @@ func findInputs(yamlContent []byte) (map[string]WorkflowInput, error) { dispatchKeyNode = node } } + } else if node.Kind == yaml.SequenceNode { + for _, node := range node.Content { + if node.Value == "workflow_dispatch" { + dispatchKeyNode = node + break + } + } } else if node.Kind == yaml.ScalarNode { if node.Value == "workflow_dispatch" { dispatchKeyNode = node diff --git a/pkg/cmd/workflow/run/run_test.go b/pkg/cmd/workflow/run/run_test.go index b10af864e..ee5195071 100644 --- a/pkg/cmd/workflow/run/run_test.go +++ b/pkg/cmd/workflow/run/run_test.go @@ -246,6 +246,11 @@ func Test_findInputs(t *testing.T) { YAML: []byte("name: workflow\non: workflow_dispatch"), wantOut: map[string]WorkflowInput{}, }, + { + name: "array of events", + YAML: []byte("name: workflow\non: [pull_request, workflow_dispatch]\n"), + wantOut: map[string]WorkflowInput{}, + }, { name: "inputs", YAML: []byte(`name: workflow