validateFeatureConfig validates feature flags declared in the workflow frontmatter and applies any action-mode override specified via the "action-mode" feature flag.
(workflowData *WorkflowData, markdownPath string)
| 96 | // validateFeatureConfig validates feature flags declared in the workflow frontmatter |
| 97 | // and applies any action-mode override specified via the "action-mode" feature flag. |
| 98 | func (c *Compiler) validateFeatureConfig(workflowData *WorkflowData, markdownPath string) error { |
| 99 | // Validate feature flags |
| 100 | workflowLog.Printf("Validating feature flags") |
| 101 | if err := validateFeatures(workflowData); err != nil { |
| 102 | return formatCompilerError(markdownPath, "error", err.Error(), err) |
| 103 | } |
| 104 | |
| 105 | // Check for action-mode feature flag override |
| 106 | if workflowData.Features != nil { |
| 107 | if actionModeVal, exists := workflowData.Features["action-mode"]; exists { |
| 108 | if actionModeStr, ok := actionModeVal.(string); ok && actionModeStr != "" { |
| 109 | mode := ActionMode(actionModeStr) |
| 110 | if !mode.IsValid() { |
| 111 | return formatCompilerError(markdownPath, "error", fmt.Sprintf("invalid action-mode feature flag '%s'. Must be 'dev', 'release', or 'script'", actionModeStr), nil) |
| 112 | } |
| 113 | workflowLog.Printf("Overriding action mode from feature flag: %s", mode) |
| 114 | c.SetActionMode(mode) |
| 115 | } |
| 116 | } |
| 117 | } |
| 118 | |
| 119 | return nil |
| 120 | } |
| 121 | |
| 122 | // validateToolConfiguration validates safe-outputs settings, on.needs and safe-job |
| 123 | // declarations, network configuration, labels, concurrency expressions, sandbox |