MCPcopy Create free account
hub / github.com/github/gh-aw / CompileToYAML

Method CompileToYAML

pkg/workflow/compiler_string_api.go:19–52  ·  view source on GitHub ↗

CompileToYAML compiles workflow data and returns the YAML as a string without writing to disk. This is useful for Wasm builds and programmatic usage.

(workflowData *WorkflowData, markdownPath string)

Source from the content-addressed store, hash-verified

17// CompileToYAML compiles workflow data and returns the YAML as a string
18// without writing to disk. This is useful for Wasm builds and programmatic usage.
19func (c *Compiler) CompileToYAML(workflowData *WorkflowData, markdownPath string) (string, error) {
20 compilerStringAPILog.Printf("CompileToYAML: markdownPath=%s", markdownPath)
21 c.markdownPath = markdownPath
22 c.skipHeader = true
23 // Clear contentOverride after compilation (set by ParseWorkflowString)
24 defer func() { c.contentOverride = "" }()
25
26 startTime := time.Now()
27 defer func() {
28 workflowLog.Printf("CompileToYAML completed in %v", time.Since(startTime))
29 }()
30
31 c.stepOrderTracker = NewStepOrderTracker()
32 c.scheduleFriendlyFormats = nil
33
34 if c.artifactManager == nil {
35 c.artifactManager = NewArtifactManager()
36 } else {
37 c.artifactManager.Reset()
38 }
39
40 lockFile := stringutil.MarkdownToLockFile(markdownPath)
41
42 if err := c.validateWorkflowData(workflowData, markdownPath); err != nil {
43 return "", err
44 }
45
46 yamlContent, _, _, err := c.generateAndValidateYAML(workflowData, markdownPath, lockFile)
47 if err != nil {
48 return "", err
49 }
50
51 return yamlContent, nil
52}
53
54// ParseWorkflowString parses workflow markdown content from a string rather than a file.
55// This is the primary entry point for Wasm/browser usage where filesystem access is unavailable.

Calls 7

validateWorkflowDataMethod · 0.95
MarkdownToLockFileFunction · 0.92
NewStepOrderTrackerFunction · 0.85
NewArtifactManagerFunction · 0.85
PrintfMethod · 0.45
ResetMethod · 0.45