X Tutup
Skip to content

Commit eb66ee9

Browse files
committed
handle array type for on: in workflow file
1 parent a9bebff commit eb66ee9

File tree

2 files changed

+12
-0
lines changed

2 files changed

+12
-0
lines changed

pkg/cmd/workflow/run/run.go

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -369,6 +369,13 @@ func findInputs(yamlContent []byte) (map[string]WorkflowInput, error) {
369369
dispatchKeyNode = node
370370
}
371371
}
372+
} else if node.Kind == yaml.SequenceNode {
373+
for _, node := range node.Content {
374+
if node.Value == "workflow_dispatch" {
375+
dispatchKeyNode = node
376+
break
377+
}
378+
}
372379
} else if node.Kind == yaml.ScalarNode {
373380
if node.Value == "workflow_dispatch" {
374381
dispatchKeyNode = node

pkg/cmd/workflow/run/run_test.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -246,6 +246,11 @@ func Test_findInputs(t *testing.T) {
246246
YAML: []byte("name: workflow\non: workflow_dispatch"),
247247
wantOut: map[string]WorkflowInput{},
248248
},
249+
{
250+
name: "array of events",
251+
YAML: []byte("name: workflow\non: [pull_request, workflow_dispatch]\n"),
252+
wantOut: map[string]WorkflowInput{},
253+
},
249254
{
250255
name: "inputs",
251256
YAML: []byte(`name: workflow

0 commit comments

Comments
 (0)
X Tutup