Skip to content

Commit

Permalink
Correct bitbucket compare URLs
Browse files Browse the repository at this point in the history
  • Loading branch information
cookpete committed Oct 23, 2017
1 parent fd50a24 commit 9d34452
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion src/templates/Default.js
Original file line number Diff line number Diff line change
Expand Up @@ -54,11 +54,19 @@ export default class Default {
renderReleaseTitle = (release, previousRelease) => {
let heading = release.tag || this.unreleasedTitle
if (previousRelease) {
heading = `[${heading}](${this.origin}/compare/${previousRelease.tag}...${release.tag || 'HEAD'})`
const href = this.renderCompareHref(this.origin, previousRelease.tag, release.tag)
heading = `[${heading}](${href})`
}
return heading
}

renderCompareHref = (origin, fromTag, toTag = 'HEAD') => {
if (/bitbucket\.com\//.test(origin)) {
return `${origin}/compare/${toTag}%0D${fromTag}`
}
return `${origin}/compare/${fromTag}...${toTag}`
}

renderList = (title, list) => {
const heading = title ? `### ${title}\n` : ''
return heading + list
Expand Down

0 comments on commit 9d34452

Please sign in to comment.