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

Function extractWorkflowDependencies

pkg/cli/status_command.go:346–376  ·  view source on GitHub ↗
(content string, frontmatter map[string]any)

Source from the content-addressed store, hash-verified

344}
345
346func extractWorkflowDependencies(content string, frontmatter map[string]any) []string {
347 unique := make(map[string]struct{})
348 addDependency := func(dependency string) {
349 normalized := normalizeWorkflowDependency(dependency)
350 if normalized != "" {
351 unique[normalized] = struct{}{}
352 }
353 }
354
355 if frontmatter != nil {
356 addDependenciesFromImports(frontmatter["imports"], addDependency)
357 }
358
359 includes, err := findIncludesInContent(content)
360 if err == nil {
361 for _, include := range includes {
362 addDependency(include)
363 }
364 }
365
366 if len(unique) == 0 {
367 return nil
368 }
369
370 dependencies := make([]string, 0, len(unique))
371 for dependency := range unique {
372 dependencies = append(dependencies, dependency)
373 }
374 slices.Sort(dependencies)
375 return dependencies
376}
377
378// addDependenciesFromImports collects dependency paths from supported imports formats:
379// string, []string, []any (string or object with "path"/"uses"), and object form

Calls 3

findIncludesInContentFunction · 0.85