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

Release notes generation with Bitbucket #388

Open
markvmk opened this issue Oct 26, 2022 · 0 comments
Open

Release notes generation with Bitbucket #388

markvmk opened this issue Oct 26, 2022 · 0 comments

Comments

@markvmk
Copy link

markvmk commented Oct 26, 2022

Hello,

The generated links for the diff and commits in the release notes are not correct when using semantic-release with Bitbucket hosted git repos, when cloning a repo using HTTPS protocol. The issue can be resolved by using SSH protocol but that sometimes requires additional effort in a CI environment, so it would be nice if both HTTPS and SSH URLs work well.

The origin of the issue is that Bitbucket adds "/scm/" in the URLs used for cloning repos using HTTPS (and they are not planning on changing this). With this, the owner of the repository is incorrectly detected as "scm" and the repository takes the value of "{owner}/{repository}" at the following line:

const [, owner, repository] = /^\/(?<owner>[^/]+)?\/?(?<repository>.+)?$/.exec(pathname);

The preset used in the affected environment is angular-bitbucket since the default angular preset (and the others) does not generate correct links for Bitbucket (could be also adjusted by using different header in the headerPartial option for the writer).

I have tried a solution which works in my environment but I am not sure if that is valid solution for all possible use cases / URLs.
Replacing line 31 here:

const repositoryUrl = options.repositoryUrl.replace(/\.git$/i, '');
with the following line:

const repositoryUrl = options.repositoryUrl.replace(/\.git$/i, '').replace(/\/scm\//, '/');

is providing the expected links for Bitbucket when using "angular-bitbucket" preset.

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

1 participant