semantic-release / release-notes-generator

:clipboard: semantic-release plugin to generate changelog content with conventional-changelog
MIT License
313 stars 47 forks source link

Wrong links in release-notes #145

Closed efuturetoday closed 5 years ago

efuturetoday commented 5 years ago

Hello all,

first thanks for your awesome work! Currently, we are using a selfhosted Gitlab instance to manage our internal source codes. I have a npm-package that is using semantic-release in order to create a Gitlab release. The problem is that the release-notes have wrong commit links.

Every commit is like this /binary-factory/wp-theme-binary-factory-ci-test/dev/6ebe4ac but it should be /binary-factory/wp-theme-binary-factory-ci-test/commit/6ebe4ac.

Here is my package.json:

{
  "name": "@binary-factory/wp-starter",
  "version": "0.0.0",
  "private": true,
  "description": "",
  "main": "index.js",
  "scripts": {
    "gulp": "gulp --gulpfile node_modules/@binary-factory/wp-builder/gulpfile.js --cwd .",
    "up": "docker-compose up",
    "wp": "docker-compose exec wordpress wp",
    "test": "echo \"Error: no test specified\" && exit 1"
  },
  "repository": {
    "type": "git",
    "url": "git@gitlab.binary-factory.de:binary-factory/wp-theme-binary-factory-ci-test.git"
  },
  "author": "binary-factory",
  "license": "ISC",
  "devDependencies": {
    "@binary-factory/wp-builder": "^1.0.1",
    "@semantic-release/changelog": "^3.0.4",
    "@semantic-release/exec": "^3.3.7",
    "@semantic-release/git": "^7.0.16",
    "@semantic-release/gitlab": "^4.0.0",
    "@types/jquery": "^3.3.30",
    "bootstrap": "^4.3.1",
    "gulp-cli": "^2.2.0",
    "jquery": "^3.4.1",
    "semantic-release": "^15.13.24"
  },
  "dependencies": {
    "normalize-scss": "^7.0.1",
    "sass-burger": "^1.3.1"
  },
  "release": {
    "plugins": [
      "@semantic-release/commit-analyzer",
      "@semantic-release/release-notes-generator",
      "@semantic-release/changelog",
      "@semantic-release/npm",
      [
        "@semantic-release/exec",
        {
          "prepareCmd": "npm run gulp bundle"
        }
      ],
      "@semantic-release/git",
      [
        "@semantic-release/gitlab",
        {
          "assets": [
            {
              "path": "package/*.zip",
              "label": "Theme"
            }
          ]
        }
      ]
    ]
  }
}

Do you have any clues what is the problem here? Thank you in advance for your time!

Best regards Oliver Haase

pvdlg commented 5 years ago

This is defined by the commit property passed to the conventional-changelog context.

By default conventional-changelog set it to commits but we set it in our default to commit for GitLab.

This value can also be set via this plugin commit option.

I guess you must have something somewhere that set that value to dev instead and override both defaults.

efuturetoday commented 5 years ago

Hello pvdlg,

thank you for your fast response. That is a good catch for me - now I know which property controls the commit links. The strange thing is I do not modify the semantic-release context in any way and just using the official plugins for it. Side note: The @semantic-release/changelogplugin does indeed generate a correct changelog where the links to the commits are correct.

pvdlg commented 5 years ago

@semantic-release/changelog doesn't generate any changelog it just write the text generated by semantic-release/release-notes-generator into a file.

The changelog text we add to the GitLab release and the one we write in CHANGELOG.md is strictly the same. If you see a difference between those two it means GitLAb change it on its side.

efuturetoday commented 5 years ago

@pvdlg it does make sense for me that the semantic-release/release-notes-generator does generate the changelog and the other plugins just consumes it. I will do a little test on my side and see if the @semantic-release/gitlab does send the right markdown to the gitlab backend. But I guess it will be fine. dev is the default branch for my repository. So it's possible, that Gitlab does process the markdown in any way and modify it. I will report the results here. Thank you for pointing this out!

efuturetoday commented 5 years ago

You can close this issue. It is obsolete. Gitlab receives the correct changelog and modifies it. I will investigate further on Gitlab. Thank you for your time and fast response!

arkadioz commented 9 months ago

Hi @pvdlg @efuturetoday I have this same issue but with bitbucket, my commits links in the release notes and changelog look like:

https://bitbucket.org/my-workspace/my-repo/commit/commitnumber

but it should be:

https://bitbucket.org/my-workspace/my-repo/commits/commitnumber

notice it should have s in commits, I notice here it is well configured https://github.com/semantic-release/release-notes-generator/blob/c4963f573930df1b5352ef38d3bc2c58286a9fb3/lib/hosts-config.js#L12

but why is my config not applying it? Am I missing something like maybe setting it up in releaserc.json file? Let me know if you need to see my .releaserc.json file or anything, thanks

SOLVED: https://github.com/conventional-changelog/conventional-changelog-config-spec/issues/90#issuecomment-1879025030