Build inline diff links for a package's changed files in the PR
(pkgDir: string, changesBaseUrl: string | null)
| 1599 | |
| 1600 | /** Build inline diff links for a package's changed files in the PR */ |
| 1601 | function buildDiffLinks(pkgDir: string, changesBaseUrl: string | null): string { |
| 1602 | if (!changesBaseUrl) return ''; |
| 1603 | const changelogPath = `${pkgDir}/CHANGELOG.md`; |
| 1604 | // GitHub anchors diff sections with #diff-<sha256 of file path> |
| 1605 | return ` <sub>[CHANGELOG.md](${changesBaseUrl}#diff-${sha256Hex(changelogPath)})</sub>`; |
| 1606 | } |
| 1607 | |
| 1608 | function sha256Hex(input: string): string { |
| 1609 | return createHash('sha256').update(input).digest('hex'); |