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

Method extractYAMLSections

pkg/workflow/workflow_builder.go:455–485  ·  view source on GitHub ↗

extractYAMLSections extracts YAML configuration sections from frontmatter

(frontmatter map[string]any, workflowData *WorkflowData)

Source from the content-addressed store, hash-verified

453
454// extractYAMLSections extracts YAML configuration sections from frontmatter
455func (c *Compiler) extractYAMLSections(frontmatter map[string]any, workflowData *WorkflowData) error {
456 workflowBuilderLog.Print("Extracting YAML sections from frontmatter")
457
458 workflowData.On = c.extractTopLevelYAMLSection(frontmatter, "on")
459 workflowData.HasDispatchItemNumber = extractDispatchItemNumber(frontmatter)
460 workflowData.Permissions = c.extractPermissions(frontmatter)
461 workflowData.Network = c.extractTopLevelYAMLSection(frontmatter, "network")
462 workflowData.ConcurrencyJobDiscriminator = extractConcurrencyJobDiscriminator(frontmatter)
463 workflowData.Concurrency = c.extractConcurrencySection(frontmatter)
464 workflowData.RunName = c.extractTopLevelYAMLSection(frontmatter, "run-name")
465 workflowData.Env = c.extractTopLevelYAMLSection(frontmatter, "env")
466 workflowData.Features = c.extractFeatures(frontmatter)
467
468 ifCondition, err := c.extractIfCondition(frontmatter)
469 if err != nil {
470 return err
471 }
472 workflowData.If = ifCondition
473
474 // Extract timeout-minutes (canonical form)
475 workflowData.TimeoutMinutes = c.extractTopLevelYAMLSection(frontmatter, "timeout-minutes")
476
477 workflowData.RunsOn = c.extractTopLevelYAMLSection(frontmatter, "runs-on")
478 if v, ok := frontmatter["runs-on-slim"]; ok && !isEmptyRunsOnValue(v) {
479 workflowData.RunsOnSlim = c.extractTopLevelYAMLSection(map[string]any{"runs-on": v}, "runs-on")
480 }
481 workflowData.Environment = c.extractTopLevelYAMLSection(frontmatter, "environment")
482 workflowData.Container = c.extractTopLevelYAMLSection(frontmatter, "container")
483 workflowData.Cache = c.extractTopLevelYAMLSection(frontmatter, "cache")
484 return nil
485}
486
487// extractConcurrencyJobDiscriminator reads the job-discriminator value from the
488// frontmatter concurrency block without modifying the original map.

Calls 9

extractPermissionsMethod · 0.95
extractFeaturesMethod · 0.95
extractIfConditionMethod · 0.95
isEmptyRunsOnValueFunction · 0.85
PrintMethod · 0.80