Conventional Commits in Collections

Howdy everyone! :cowboy_hat_face:

The Red Hat team that works on many of the cloud content collections has been discussing the adoption of the conventional commits format. We wanted to bring this to the attention of the wider community and hear your feedback and any concerns.

For further context, the cloud content collections are outlined in the Collections Overview section of the team handbook.

A brief overview

Conventional commits provide a lightweight structure that makes the type and scope of a change immediately clear from the commit message.

A conventional commit message has the following format:

<type>(<scope>): <description>

[optional body]

[optional footer(s)]

Descriptions should use the imperative: “fix bug” not “fixed bug” or “fixes bug”. This aligns with git’s own internal commit messages (e.g. Merge branch…, Revert “…”), keeping the wording consistent across the entire history.

Here are some examples of commit messages for typical collection changes:

  • feat(ec2_instance): add support for instance bandwidth weighting

  • fix(s3_bucket): correct tag comparison when values contain colons

  • docs(aws_az_info): clarify availability zone filter behavior

  • ci: add integration test for iam_role assume policy

Benefits of adopting conventional commits

Standard commit messages, such as conventional commits, carry more meaning than unstructured ones. A prefix like fix:, feat:, or docs: tells the reader what kind of change was made without opening the diff. This makes it easier to scan project history, understand the purpose of changes, and work across collection repos.

Conventional commits also promote atomicity. Choosing a single type for each commit encourages you to keep commits small and focused on one logical change. Atomic commits simplify code review, make reverts safer, and produce a history that is easier to bisect.

Complementing changelogs

Conventional commits complement changelog fragments, not replace them. Changelog fragments are written for collection users and describe changes in terms of user-visible behavior. On the other hand, commit messages are written for developers and describe what changed in the code. These serve different audiences and should read differently.

Conventional commits can add value as a cross-check. Contributors can find it difficult to know which changelog fragment category to use or if a fragment is needed at all. A conventional commit type provides a straightforward signal. A fix: commit most likely needs a bugfixes fragment. A feat: commit most likely needs a minor_changes fragment. A commit with a BREAKING CHANGE: footer should have a breaking_changes fragment.

A CI check could also flag mismatches. For example, a check might catch a PR with a feat: commit but no changelog fragment. This could help catch missing changelogs before they slip through and reduce the need for manual checks at release time.

Enforcing conventional commits

We also discussed enforcing conventional commits with a CI gate using commitizen.

While it might be a good idea to enforce conventional commits for folks on a dedicated team, we recognize that it might create friction or annoyance for others. With that in mind, it seems like a good idea to be relaxed about enforcement and make the check optional for occasional or first-time contributors.

We could add a bot account that would detect non-conventional commit messages and gently suggest a conventional format, much like how the ansible-documentation-bot encourages PR descriptions.

One thing to note is that repos that use squash merges via Zuul only need to have a conventional commit message in the PR title, not every individual commit. This is how the amazon.aws collection is configured. You can see an example from this PR and the resulting squash commit.

Asking for feedback

What do folks think about this proposal? Are you aware of any other benefits to using conventional commits with Ansible collections or other projects?

What do you think about the idea to add a CI gate for conventional commits? If you’re a contributor to a collection or a collection maintainer, we’d love to hear what you think.

If you maintain or contribute to a collection, have you run into cases where clearer commit messages would have helped?

Do you see any potential issues with adopting conventional commits or have any concerns with collections adopting that format?

1 Like

What do folks think about this proposal?

It is great!

Are you aware of any other benefits to using conventional commits with Ansible collections or other projects?

Proper release process - see GitHub - googleapis/release-please: generate release PRs based on the conventionalcommits.org spec · GitHub

What do you think about the idea to add a CI gate for conventional commits? If you’re a contributor to a collection or a collection maintainer, we’d love to hear what you think.

If you want to enforce something this has to be checked in CI and be a gate for merge / rebase.
Disclosure - I am not contributor to any community collections.

If you maintain or contribute to a collection, have you run into cases where clearer commit messages would have helped?

Yes, they completely replace changelogs, again see GitHub - googleapis/release-please: generate release PRs based on the conventionalcommits.org spec · GitHub

Do you see any potential issues with adopting conventional commits or have any concerns with collections adopting that format?

In the agent era - no friction for maintainers to use conventional commits. I’ve tried them quite some time ago - could not force myself to think in the “conventional commit” way. Now just ask an agent to rewrite the history.

And please, please adopt release please action from Google - https://github.com/googleapis/release-please

The way releases are done now is so 2015.

What do you think about the idea to add a CI gate for conventional commits?

For collections where there’s a backlog of PRs, this has the potential to add a lot of friction for anyone trying to work to clear the backlog. Especially if all of the commits in the PR need to match the “conventional commits” standard.

For collections where the commits are squashed and use the PR title/description this won’t be so bad, as someone/something can go through and update the PR titles.

This will also work a lot better if there are standard hooks in place.

If you maintain or contribute to a collection, have you run into cases where clearer commit messages would have helped?

Clearer PR descriptions, certainly. Commit messages within a PR, very rarely. But I’m most involved in collections where we squash the commits and use the PR title / description for the commit message.

Do you see any potential issues with adopting conventional commits or have any concerns with collections adopting that format?

It really depends how strictly you apply it. Personally I would start with an optional approach, and move to an enforcing approach much later.

That’s only true for folks using AI tooling.

I still see a lot of community contributions which appear to be human contributions rather than AI agents. There are still a lot of Open Source folks who are staunchly anti-AI, we should be careful not to push them away from our collections over something that is even more of a “nice to have” than things like code linting standards.

3 Likes

This has been suggested more than once (and a lot of projects I know use that), and IMO it’s one of the worst way to generate changelogs. Commit messages are for developers and maintainers working on the collection. Changelog messages are for users of the collection. While there is a certain intersection between these two groups, they are generally very separate, are interested in different things, and thus should receive different information.

Besides that, I personally don’t like conventional commits that much and don’t use them in my projects, but I don’t mind using them in other projects where the maintainers prefer to have them.

1 Like

As long as Zuul is around, there isn’t much way of improving the release process - at least for community collections.