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

Function parseLocalWorkflowSpec

pkg/cli/spec.go:426–444  ·  view source on GitHub ↗

parseLocalWorkflowSpec parses a local workflow specification starting with "./"

(spec string)

Source from the content-addressed store, hash-verified

424
425// parseLocalWorkflowSpec parses a local workflow specification starting with "./"
426func parseLocalWorkflowSpec(spec string) (*WorkflowSpec, error) {
427 specLog.Printf("Parsing local workflow spec: %s", spec)
428 // Validate that it's a .md file
429 if !strings.HasSuffix(spec, ".md") {
430 specLog.Printf("Invalid extension for local workflow: %s", spec)
431 return nil, fmt.Errorf("local workflow specification must end with '.md' extension: %s", spec)
432 }
433
434 specLog.Printf("Parsed local workflow: path=%s", spec)
435
436 return &WorkflowSpec{
437 RepoSpec: RepoSpec{
438 RepoSlug: "", // Local workflows have no remote repo
439 Version: "", // Local workflows have no version
440 },
441 WorkflowPath: spec, // Keep the "./" prefix in WorkflowPath
442 WorkflowName: strings.TrimSuffix(filepath.Base(spec), ".md"),
443 }, nil
444}
445
446// parseSourceSpec parses a source specification like "owner/repo/path@ref"
447// This is used for parsing the source field from workflow frontmatter

Callers 1

parseWorkflowSpecFunction · 0.85

Calls 2

PrintfMethod · 0.45
ErrorfMethod · 0.45

Tested by

no test coverage detected