Conventional Commits#

Configuration#

Add the ParseConventionalCommit action to the summary_pipeline configuration.

summary_pipeline:
  - action: strip_spaces
    id: strip-spaces
  - action: Strip
    id: strip-periods
    comment: Get rid of any periods so we don't get double periods
    kwargs:
      chars: .
  - action: ParseConventionalCommit
    id: parse-conventional-commit
    kwargs:
      commit_metadata: save_commit_metadata
  - action: SetDefault
    id: set-default-message
    args:
      - no commit message
  - action: capitalize
    id: capitalize
  - action: append_dot
    id: add-period

Add the ParseBreakingChangeFooter action to the body_pipeline configuration.

body_pipeline:
  - action: ParseBreakingChangeFooter
    comment: Parse for a breaking change first so it doesn't get stripped out in the next step
    kwargs:
      commit_metadata: save_commit_metadata
  - action: ParseTrailers
    comment: Parse the trailers into metadata.
    kwargs:
      commit_metadata: save_commit_metadata

Update the group_by configuration. This example orders it by the category (set by the commit_classifiers) and then by the first scope, if it exists.

group_by:
  - metadata.category
  - metadata.scope.0

Set the commit_classifiers configuration.

commit_classifiers:
  - action: MetadataMatch
    category: Breaking Changes
    kwargs:
      attribute: has_breaking_change
      operator: is
      value: True
  - action: MetadataMatch
    category: New Features
    kwargs:
      attribute: commit_type
      operator: ==
      value: feat
  - action: MetadataMatch
    category: Updates
    kwargs:
      attribute: commit_type
      operator: in
      value: [ "fix", "Fix", "refactor", "Refactor", "update", "Update" ]
  - action: null
    category: Other

The commit is classsified by the first rule that matches. So the rules in this example are:

  1. “Breaking Changes” if the commit’s metadata includes has_breaking_change and it is True

  2. “New Features” if the commit’s metadata includes commit_type and it is feat

  3. “Updates” if the commit’s metadata includes commit_type and it is fix, refactor, or update

  4. “Other” if there are no other matches

To filter out some commit types, use ignore_patterns:

ignore_patterns:
  - (?i)^(?:build|chore|ci|docs|style|perf|test):