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

Function ComputeBodyHashFromFile

pkg/parser/frontmatter_hash.go:561–574  ·  view source on GitHub ↗

ComputeBodyHashFromFile computes the body hash for a workflow file from disk.

(filePath string)

Source from the content-addressed store, hash-verified

559
560// ComputeBodyHashFromFile computes the body hash for a workflow file from disk.
561func ComputeBodyHashFromFile(filePath string) (string, error) {
562 content, err := DefaultFileReader(filePath)
563 if err != nil {
564 return "", fmt.Errorf("failed to read file: %w", err)
565 }
566
567 frontmatterText, markdownBody, err := extractFrontmatterAndBodyText(string(content))
568 if err != nil {
569 return "", fmt.Errorf("failed to extract frontmatter: %w", err)
570 }
571
572 baseDir := filepath.Dir(filePath)
573 return ComputeBodyHashFromParsedContent(markdownBody, frontmatterText, baseDir, DefaultFileReader)
574}
575
576// computeFrontmatterHashTextBasedWithReader computes the hash using text-based approach with custom file reader.
577// When markdown is non-empty, it is included as the full body text in the canonical data (used for

Calls 3

ErrorfMethod · 0.45