conventional-changelog / standard-version

:trophy: Automate versioning and CHANGELOG generation, with semver.org and conventionalcommits.org
ISC License
7.65k stars 787 forks source link

Where does <owner> and <repository> come from? (non-JS, non-Github) #656

Open howardjones opened 4 years ago

howardjones commented 4 years ago

I use Azure Devops for a python project. I've been using conventional commits for the lifetime of the project, so I liked the idea of standard-version.

When I run it, I get a CHANGELOG.md with incorrect links to the changes - https://dev.azure.com//commit/598788656ef276375f34da9b42837cf15f86f89d

It seems to be missing the <owner> and <repository> fields in the URL. Where does standard-version get those from? Do I need some kind of dummy package.json?

SohamJ commented 3 years ago

Trying to figure out missing owner and repository fields, I found that both are set in the core's mergeConfig.js.

Owner and repo seems to be coming from either the context or the package file (package.json for example). I may be wrong, but in the case of non-node project, it seems this has to come from context.

The context is referred in the conventionalcommit writeopts.

One interesting observation is that setting { "preset": "angular" } in the .versionrc.json populates the fields. So it seems that the issue is with conventionalcommit preset, although I'm not yet sure where that difference is.

You can also refer to this reply in standard-version #384 Any pointers to figure that out would be super helpful!

kiiiiwiiii commented 3 years ago

As i found in this article: https://medium.com/@jazz.twk/automate-versioning-in-cicd-with-azure-devops-a65a9a6f4e69 you should configure your .versionrc like so:

{
  "compareUrlFormat":"{{host}}/your_azure_repo_link/branchCompare?baseVersion=GT{{previousTag}}&targetVersion=GT{{currentTag}}",
  "commitUrlFormat": "{{host}}/your_azure_repo_link/commit/{{hash}}"
}

Replace your_azure_repo_link with OrganizationName/ProjectName/_git/RepositoryName

SohamJ commented 3 years ago

As i found in this article: https://medium.com/@jazz.twk/automate-versioning-in-cicd-with-azure-devops-a65a9a6f4e69 you should configure your .versionrc like so:

{
  "compareUrlFormat":"{{host}}/your_azure_repo_link/branchCompare?baseVersion=GT{{previousTag}}&targetVersion=GT{{currentTag}}",
  "commitUrlFormat": "{{host}}/your_azure_repo_link/commit/{{hash}}"
}

Replace your_azure_repo_link with OrganizationName/ProjectName/_git/RepositoryName

Thanks for the reply, this is what I did for Bitbucket for now -

{
  "commitUrlFormat": "https://<host>/projects/<project>/repos/<repo>/commits/{{hash}}",
  "compareUrlFormat": "https://<host>/projects/<project>/repos/<repo>/compare/diff?targetBranch=refs%2Ftags%2F{{previousTag}}&sourceBranch=refs%2Ftags%2F{{currentTag}}",
  "userUrlFormat": "https://<host>/users/{{user}}",
}

The compareUrl follows the new compare URL format that Bitbucket added post v6.3.

I still am not sure why angular preset works but not conventionalcommits. Was hoping to figure that out to see if there can be any enhancement to conventionalcommits preset or perhaps update to the angular-bitbucket project.