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

Function RunHashFrontmatter

pkg/cli/hash_command.go:42–63  ·  view source on GitHub ↗

RunHashFrontmatter computes and prints the frontmatter hash for a workflow

(workflowPath string)

Source from the content-addressed store, hash-verified

40
41// RunHashFrontmatter computes and prints the frontmatter hash for a workflow
42func RunHashFrontmatter(workflowPath string) error {
43 hashLog.Printf("Computing frontmatter hash for: %s", workflowPath)
44
45 // Check if file exists
46 if _, err := os.Stat(workflowPath); os.IsNotExist(err) {
47 fmt.Fprintln(os.Stderr, console.FormatErrorMessage("workflow file not found: "+workflowPath))
48 return fmt.Errorf("workflow file not found: %s", workflowPath)
49 }
50
51 // Compute hash
52 cache := parser.NewImportCache("")
53 hash, err := parser.ComputeFrontmatterHashFromFile(workflowPath, cache)
54 if err != nil {
55 fmt.Fprintln(os.Stderr, console.FormatErrorMessage(err.Error()))
56 return err
57 }
58
59 // Print hash to stdout (for easy parsing by scripts)
60 fmt.Fprintln(os.Stdout, hash)
61
62 return nil
63}

Callers 1

NewHashCommandFunction · 0.85

Calls 6

FormatErrorMessageFunction · 0.92
NewImportCacheFunction · 0.92
PrintfMethod · 0.45
ErrorfMethod · 0.45
ErrorMethod · 0.45

Tested by

no test coverage detected