Merge pull request #3404 from cli/on-array

handle array type for on: in workflow file
This commit is contained in:
Nate Smith 2021-04-12 12:12:11 -05:00 committed by GitHub
commit 0e7a657984
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
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