From 64d9c0874af3ba7ab890826462971f9da0e78c49 Mon Sep 17 00:00:00 2001 From: Anthony Fu Date: Mon, 13 Jun 2022 17:44:54 +0800 Subject: [PATCH] fix: proper display refs --- src/markdown.ts | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/markdown.ts b/src/markdown.ts index 9da60df..2b317df 100644 --- a/src/markdown.ts +++ b/src/markdown.ts @@ -16,8 +16,13 @@ export function generateMarkdown(commits: GitCommit[], config: ChangelogOptions) const lines = group.reverse() .map((commit) => { const scope = commit.scope ? `**${commit.scope.trim()}:** ` : '' - const ref = `[\`${commit.references[0]}\`](https://github.com/${config.github}/commit/${commit.references[0]})` - const line = `- ${scope}${commit.description} ${ref}` + const refs = commit.references.map((r) => { + const url = r[0] === '#' + ? `https://github.com/${config.github}/issues/${r.slice(1)}` + : `https://github.com/${config.github}/commit/${r}` + return `[\`${r}\`](${url})` + }).join(' ') + const line = `- ${scope}${commit.description} ${refs}` if (commit.isBreaking) { breakingChanges.push(line) return undefined