fix(templates): suppress warn code flag not found

on validate.

fixes #6498

Signed-off-by: Dwi Siswanto <git@dw1.io>
This commit is contained in:
Dwi Siswanto 2025-09-27 13:34:28 +07:00
parent 8ea5061f5e
commit 95a72cfd50
No known key found for this signature in database
GPG Key ID: 3BB198907EF44CED

View File

@ -94,7 +94,14 @@ func parseWorkflowTemplate(workflow *workflows.WorkflowTemplate, preprocessor Pr
if len(template.RequestsCode) > 0 { if len(template.RequestsCode) > 0 {
if !options.Options.EnableCodeTemplates { if !options.Options.EnableCodeTemplates {
// NOTE(dwisiswant0): It is safe to continue here during
// validation mode, because the template has already been parsed
// and syntax-validated by templates.Parse() above. It only
// prevents adding to workflow's executer list and suppresses
// warning messages.
if !options.Options.Validate {
gologger.Warning().Msgf("`-code` flag not found, skipping code template from workflow: %v\n", path) gologger.Warning().Msgf("`-code` flag not found, skipping code template from workflow: %v\n", path)
}
continue continue
} else if !template.Verified { } else if !template.Verified {
// unverfied code templates are not allowed in workflows // unverfied code templates are not allowed in workflows