(markdown: string, file?: string)
| 1938 | } |
| 1939 | |
| 1940 | function markdownRepository(markdown: string, file?: string): string { |
| 1941 | const fromMarkdown = frontMatterValue(markdown, "repository"); |
| 1942 | if (fromMarkdown) return normalizeRepo(fromMarkdown); |
| 1943 | if (file) { |
| 1944 | const normalizedPath = repoRelativePath(file); |
| 1945 | const recordsMatch = normalizedPath.match(/^records\/([^/]+)\//); |
| 1946 | if (recordsMatch?.[1]) { |
| 1947 | const profile = repositoryProfileForSlug(recordsMatch[1]); |
| 1948 | if (profile) return profile.targetRepo; |
| 1949 | } |
| 1950 | const parsed = parseReportFileName(basename(file)); |
| 1951 | if (parsed?.repo) return parsed.repo; |
| 1952 | } |
| 1953 | return DEFAULT_TARGET_REPO; |
| 1954 | } |
| 1955 | |
| 1956 | function isMarkdownForActiveRepo(markdown: string, file?: string): boolean { |
| 1957 | return markdownRepository(markdown, file) === targetRepo(); |
no test coverage detected