extractFrontmatterDescription extracts the description from YAML frontmatter. Handles the simple case: a line starting with "description:" between --- delimiters.
(content string)
| 636 | // extractFrontmatterDescription extracts the description from YAML frontmatter. |
| 637 | // Handles the simple case: a line starting with "description:" between --- delimiters. |
| 638 | func extractFrontmatterDescription(content string) string { |
| 639 | lines := strings.Split(content, "\n") |
| 640 | inFrontmatter := false |
| 641 | for _, line := range lines { |
| 642 | trimmed := strings.TrimSpace(line) |
| 643 | if trimmed == "---" { |
| 644 | if !inFrontmatter { |
| 645 | inFrontmatter = true |
| 646 | continue |
| 647 | } |
| 648 | break // end of frontmatter |
| 649 | } |
| 650 | if !inFrontmatter { |
| 651 | continue |
| 652 | } |
| 653 | if strings.HasPrefix(trimmed, "description:") { |
| 654 | desc := strings.TrimPrefix(trimmed, "description:") |
| 655 | desc = strings.TrimSpace(desc) |
| 656 | // Remove surrounding quotes. |
| 657 | desc = strings.Trim(desc, `"'`) |
| 658 | return desc |
| 659 | } |
| 660 | } |
| 661 | return "" |
| 662 | } |
| 663 | |
| 664 | // resolveGitHubAuth returns a GitHub API auth header by checking, in order: |
| 665 | // 1. GITHUB_TOKEN env var |
no outgoing calls
no test coverage detected