eventbrite-sdk-javascript icon indicating copy to clipboard operation
eventbrite-sdk-javascript copied to clipboard

Look into commitlint

Open jonathancreamer-eb opened this issue 6 years ago • 12 comments

There's a way to use git precommit hooks to validate git commit messages. It's very useful in cases where we're going to use conventional commits, or even potentially over in EDS (although in EDS it'd be cool to move to conventional commits too).

https://github.com/marionebl/commitlint

jonathancreamer-eb avatar Jul 02 '18 15:07 jonathancreamer-eb

I think @kwelch had brought this up way at the beginning. And the issue is that we really want this for PRs, not for individual commits right? Like I want to be able to work on a feature branch and make a dozen commits w/o each one of them having to follow the commit convention. Does commitlint support that? Otherwise I guess I'm gonna have to bypass commit hooks?

benmvp avatar Jul 02 '18 18:07 benmvp

I mostly forgot about that. We could put a bot in place for title linting for PRs only. Here is my original comment on the bot that we could use. https://github.com/eventbrite/eventbrite-sdk-javascript/issues/16#issuecomment-378713637

kwelch-eb avatar Jul 02 '18 19:07 kwelch-eb

Ideally if you're going to be doing conventional commits, each commit with show up as an entry in the CHANGELOG.md.

jonathancreamer-eb avatar Jul 02 '18 20:07 jonathancreamer-eb

And if you don't want a particular commit to show up, then yeah you'd commit -n.

jonathancreamer-eb avatar Jul 02 '18 20:07 jonathancreamer-eb

One of the main benefits of conventional commits is to use https://github.com/conventional-changelog/standard-version, which generates a CHANGELOG.md, and does automatic package.json version bumps.

jonathancreamer-eb avatar Jul 02 '18 20:07 jonathancreamer-eb

This is a nice post about standard-version http://devboosts.com/2017/03/28/conventional-commits/, and an output automatic CHANGELOG.md example... https://github.com/lonelyplanet/backpack-ui/blob/master/CHANGELOG.md.

jonathancreamer-eb avatar Jul 02 '18 20:07 jonathancreamer-eb

I think we mitigate that need by exclusively using squash merge, right?

kwelch-eb avatar Jul 02 '18 21:07 kwelch-eb

That's one possible scenario yea.

jonathancreamer-eb avatar Jul 02 '18 22:07 jonathancreamer-eb

Yeah we squash merge everything, so it's really the PR title that matters.

We're using semantic-release in our .travis.yml for releasing and it creates the Github release for us. Sounds like they're doing the same thing?

benmvp avatar Jul 02 '18 23:07 benmvp

Currently we don't have automated process to ensure that commits are covered properly. However, since we are squashing the time to check that is post merge to be true to it. Is this something that would cover that scenario?

kwelch avatar Jul 03 '18 01:07 kwelch

Re-read that 2nd sentence 3 times and still not 100% sure what you're trying to say 😄

benmvp avatar Jul 03 '18 05:07 benmvp

Oh basically, a bot would cover the title of the PR, but since we are squashing the PR and it allows you to change the title of the commit, we would need to somehow enforce the proper "lint" during that phase of the workflow. It seems like a commit hook would be best to consistently ensure that it will work, but it would be on the GH side not on the local side.

kwelch avatar Jul 03 '18 13:07 kwelch