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

Function extractSafeJobsFromFrontmatter

pkg/workflow/safe_jobs.go:367–381  ·  view source on GitHub ↗

extractSafeJobsFromFrontmatter extracts safe-jobs configuration from frontmatter. Only checks the safe-outputs.jobs location. The top-level "safe-jobs" syntax is NOT supported.

(frontmatter map[string]any)

Source from the content-addressed store, hash-verified

365// extractSafeJobsFromFrontmatter extracts safe-jobs configuration from frontmatter.
366// Only checks the safe-outputs.jobs location. The top-level "safe-jobs" syntax is NOT supported.
367func extractSafeJobsFromFrontmatter(frontmatter map[string]any) map[string]*SafeJobConfig {
368 // Check location: safe-outputs.jobs
369 if safeOutputs, exists := frontmatter["safe-outputs"]; exists {
370 if safeOutputsMap, ok := safeOutputs.(map[string]any); ok {
371 if jobs, exists := safeOutputsMap["jobs"]; exists {
372 if jobsMap, ok := jobs.(map[string]any); ok {
373 c := NewCompiler() // Create a temporary compiler instance for parsing
374 return c.parseSafeJobsConfig(jobsMap)
375 }
376 }
377 }
378 }
379
380 return make(map[string]*SafeJobConfig)
381}
382
383// mergeSafeJobs merges safe-jobs from multiple sources and detects name conflicts
384func mergeSafeJobs(base map[string]*SafeJobConfig, additional map[string]*SafeJobConfig) (map[string]*SafeJobConfig, error) {

Calls 2

parseSafeJobsConfigMethod · 0.95
NewCompilerFunction · 0.85

Tested by 1