atlassian / lerna-semantic-release

📦:🛠✨💥 – fully automated package publishing
https://www.npmjs.com/package/lerna-semantic-release
679 stars 42 forks source link

Use scope to detect relevant commit #73

Closed elmariofredo closed 7 years ago

elmariofredo commented 7 years ago

Currently relevant commits are detected using affects string in commit messages, but for that we have scope in angular preset which is what semantic-release use by default https://github.com/semantic-release/semantic-release#default-commit-message-format.

Would you be interested to add support for scope matching in isRelevant as additional detection mechanism?

jpnelson commented 7 years ago

The problem would be that a single commit can affect multiple packages, but most tools limit the first line of a commit to 100 characters, with very few special characters (I've seen some validators disallow spaces in the scope)

Is there a reason why you'd prefer using the scope over the affects line?

elmariofredo commented 7 years ago

good point but I think that multi package changes should not happen that often and for that rare cases we will still have affects line.

Reason is that affects line is duplicate of scope which is not really DRY and it's prone to errors.

elmariofredo commented 7 years ago

Actually I have found issue with this approach because currently lerna-semantic-release is using https://github.com/semantic-release/commit-analyzer which use old version of https://github.com/ajoslin/conventional-changelog which use git parser in ./node_modules/conventional-changelog/lib/git.js with following commit match pattern /^(\w*)(\(([\w\$\.\-\* ]*)\))?\: (.*)$/ which won't match scope with slash.

So other changes are required than in lerna-semantic-release.

jpnelson commented 7 years ago

I do agree that the affects line and "scope" fulfil similar purposes. I've been using the scope to refer to things outside of the packages/ folder – there may be some uses for it in things like "build" / "docs" etc.

As you say, some tools won't like long first lines, or special characters / spaces in the scope. Thanks for investigating :)

elmariofredo commented 7 years ago

yeah it was a looong ride to get to this resolution 😂