ComputeBodyHashFromFile computes the body hash for a workflow file from disk.
(filePath string)
| 559 | |
| 560 | // ComputeBodyHashFromFile computes the body hash for a workflow file from disk. |
| 561 | func 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 |