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

Function existingWorkflowHasSource

pkg/cli/deploy_command.go:326–348  ·  view source on GitHub ↗
(path string)

Source from the content-addressed store, hash-verified

324}
325
326func existingWorkflowHasSource(path string) (bool, error) {
327 content, err := os.ReadFile(path)
328 if err != nil {
329 if errors.Is(err, os.ErrNotExist) {
330 return false, nil
331 }
332 return false, fmt.Errorf("failed to read workflow %s: %w", path, err)
333 }
334
335 result, err := parser.ExtractFrontmatterFromContent(string(content))
336 if err != nil {
337 deployLog.Printf("Failed to parse frontmatter in %s while checking source field: %v (treating workflow as non-sourced and proceeding with add)", path, err)
338 return false, nil
339 }
340
341 sourceValue, ok := result.Frontmatter["source"]
342 if !ok {
343 return false, nil
344 }
345
346 source, ok := sourceValue.(string)
347 return ok && strings.TrimSpace(source) != "", nil
348}

Callers 1

Calls 3

ErrorfMethod · 0.45
PrintfMethod · 0.45

Tested by

no test coverage detected