momocow / semantic-release-gitmoji

✨🐛💥 A semantic-release plugin for gitmojis. Different from conventional changelog, Gitmoji commits are used to determine a release type and generate release notes.
MIT License
86 stars 20 forks source link

Context attribute "compareUrl" is not working with bitbucket repository #90

Open arkadioz opened 5 months ago

arkadioz commented 5 months ago

@momocow I was using the tool with github, but now I am trying to setup everything on bitbucket too, I notice that this on my default handlebars template (which is the same from the example but with the emojis):

{{#if compareUrl}}
# 🎉 [v{{nextRelease.version}}]({{compareUrl}}) ({{datetime "UTC:yyyy-mm-dd"}}) 🔖
{{else}}
# 🎉 v{{nextRelease.version}} ({{datetime "UTC:yyyy-mm-dd"}}) 🔖
{{/if}}

works with github repository, but with bitbucket it is always entering the else, is there anyway to make it work with bitbucket too?

When I was using release-notes generator plugin I also had to do some tweaks for it to work with bitbucket like so:

[
      "@semantic-release/release-notes-generator",
      {
        "preset": "conventionalcommits",
        "presetConfig": {
          "commitUrlFormat": "{{host}}/{{owner}}/{{repository}}/commits/{{hash}}",
          "compareUrlFormat": "{{host}}/{{owner}}/{{repository}}/compare/{{previousTag}}..{{currentTag}}",
          "types": [
            {
              "type": "feat",
              "section": "New Feature(s) 🚀"
            },
            {
              "type": "fix",
              "section": "Bug Fix(es) 🐛️"
            }
          ]
        }
      }
    ]

Please let me know if I can do something like this to get the compare url working, the commit url was easy to fix on the commit template but the compare url not sure how to fix.

EDIT: I was reading again this https://github.com/momocow/semantic-release-gitmoji?tab=readme-ov-file#releasenotesoptions

you mention that github is currently the only repo supported but you also mention that it is possible to override the baseUrl and other values, can you please show example how to override them? Maybe this way it can work with bitbucket too

momocow commented 5 months ago

After looking into source codes, I should admit that it is not easy to customize this in the current version without monkey patches.

I have marked this one as an enhancement. A more extendable pattern should be adopted to design this cross-platform VCS (Version Control System) feature.

arkadioz commented 5 months ago

@momocow Thanks, it would be amazing to have such a enhancement, meanwhile this is what I did on the default-handlebar template:

Replaced the if/else statement with this one:

# 🎉 [v{{nextRelease.version}}](https://{{source}}/{{owner}}/{{repo}}/compare/v{{lastRelease.version}}..v{{nextRelease.version}}) ({{datetime "UTC:yyyy-mm-dd"}}) 🔖

works so far but yeah I would prefer a lot more the enhancement, thanks again :)