Add a commit hook to ensure good commit msg style

I think it would be cool to add something like the “Validate PR title” Github Action in a custom pre-commit hook in order to check the commit msg format.

We did it here, and we have this piece of code in our .pre-commit-config.yaml on our projects:

  - repo:
    rev: v1.2.0
    -   id: commit-msg
        always_run: true

What do you think?

What guidelines would you enforce?

We’re using the bluejava’s git commit guide at work, but any of the existing commit message guidelines would be cool.

Edit: I saw in CONTRIBUTING.rst that django-cms commits should follow the Conventional Commits Guidelines.

The conventional commit guidelines are enforced by the PR title check: When merging a PR all commits are squashed into a single one using the PR title. By this, all commit titles of the develop branch should also follow the conventional commit guidelines.
That’s actually important since the commits (former PR titles) are evaluated and taken as a basis for the changelog and the release notes.

Okay I see. Thanks for the explanation :slight_smile:

1 Like