Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Comparison links in changelog not working for bitbucket #131

Closed
sondrele opened this issue Jun 3, 2019 · 3 comments
Closed

Comparison links in changelog not working for bitbucket #131

sondrele opened this issue Jun 3, 2019 · 3 comments

Comments

@sondrele
Copy link

sondrele commented Jun 3, 2019

I've configured a couple of projects on bitbucket cloud to use semantic-release, and I've noticed a small issue where the comopare link the generated CHANGELOG.md results in a 404.

Description

Generated release note in CHANGELOG.md

# [1.1.0](http://bitbucket.org/<PROJECT>/<REPO>/compare/v1.0.0...v1.1.0) (2019-06-03)


### Features

* **foo:** my feature ([46b6609](http://bitbucket.org/<PROJECT>/<REPO>/commits/46b6609))

The link above results in a 404 on bitbucket, instead it should be (found on SO):

# [1.1.0](https://bitbucket.org/<PROJECT>/<REPO>/branches/compare/v1.1.0%0Dv1.0.0) (2019-06-03)

Solution

Is this a problem that you're aiming on fixing as part of this package (being that the major git hosting providers seams to be supported)?

@pvdlg
Copy link
Member

pvdlg commented Jun 8, 2019

We use conventional-changelog/conventional-changelog to generate the content of the changelog.

The problem is over there: conventional-changelog/conventional-changelog#185

@pvdlg pvdlg closed this as completed Jun 8, 2019
@FilipSwiatczak
Copy link

Since it doesn't look like conventional-changelog are too hot on fixing #185 (3 years old), here's an easy workaround for Bitbucket Server! It might be same for cloud, not sure

Add following snippet to your package.josn under release -> plugins.
[ "@semantic-release/release-notes-generator", { "preset": "conventionalcommits", "presetConfig": { "commitUrlFormat": "{{host}}/projects/EN/repos/your-repo-name/commits/{{hash}}", "compareUrlFormat": "{{host}}/projects/EN/repos/your-repo-name/compare/diff?targetBranch=refs%2Ftags%2F{{previousTag}}&sourceBranch=refs%2Ftags%2F{{currentTag}}" } } ]

You may notice "your-repo-name" is not {{owner}} since the latter incorrectly begins with en/ for bitbucket.

That will sort you out for both commit links and compare links. Syntax is taken from here: https://github.com/conventional-changelog/conventional-changelog-config-spec/blob/master/versions/2.0.0/README.md#substitutions-1
All the values there go directly into presetConfig, as above. Cheers

@AlbertoGODev
Copy link

This config work for me:

[ "@semantic-release/release-notes-generator", { "preset": "conventionalcommits", "presetConfig": { "commitUrlFormat": "{{host}}/{{owner}}/{{repository}}/commits/{{hash}}", "compareUrlFormat": "{{host}}/{{owner}}/{{repository}}/compare/{{currentTag}}%0D{{previousTag}}#diff", "issueUrlFormat ": "{{host}}/{{owner}}/{{repository}}/issue/{{id}}" } } ]

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants