handle array type for on: in workflow file

This commit is contained in:
vilmibm 2021-04-12 12:05:05 -05:00
parent a9bebff03f
commit eb66ee9dfe
2 changed files with 12 additions and 0 deletions

View file

@ -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

View file

@ -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