validate code template in workflows (#4822)

* validate code template in workflows

* fix missing executer
dev
Tarun Koyalwar 2024-03-01 21:30:03 +05:30 committed by GitHub
parent 4c7a0f424e
commit e86f382997
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 10 additions and 0 deletions

View File

@ -80,6 +80,16 @@ func parseWorkflowTemplate(workflow *workflows.WorkflowTemplate, preprocessor Pr
gologger.Warning().Msgf("Could not parse workflow template %s: no executer found\n", path)
continue
}
if len(template.RequestsCode) > 0 {
if !options.Options.EnableCodeTemplates {
gologger.Warning().Msgf("`-code` flag not found, skipping code template from workflow: %v\n", path)
continue
} else if !template.Verified {
// unverfied code templates are not allowed in workflows
gologger.Warning().Msgf("skipping unverified code template from workflow: %v\n", path)
continue
}
}
workflowTemplates = append(workflowTemplates, template)
}