Skip to content

Messages with an exclamation mark after type ("feat!") fail with Angular config #2226

Closed
@aleksator

Description

@aleksator

Indicating breaking changes with ! after type does not work when extending Angular config, but should be possible according to Conventional Commits 1.0.0.

I'm using this project through the Github Action, which currently uses commitlint 9.0.1 under the hood.

Expected Behavior

Commit message like feat!: the message has an exclamation mark should pass the lint.

Current Behavior

Lint does not pass with the following error message:

⧗ input: feat!: the message has an exclamation mark
✖ subject may not be empty [subject-empty]
✖ type may not be empty [type-empty]

Affected packages

  • cli
  • core
  • prompt
  • config-angular

Possible Solution

A workaround is to extend config-conventional instead.
.commitlintrc.yml:

extends:
  - '@commitlint/config-conventional'

Since they are different, desired rules from config-angular have to also be defined below, but they are not relevant to this bug so they have been omitted.

A proper solution would be to fix this in commitlint.

Steps to Reproduce (for bugs)

  1. In the repository root create file:
    .commitlintrc.yml:
extends:
  - '@commitlint/config-angular'
  1. Enable Github Actions with the following configuration:
    .github/workflows/ci.yml:
name: CI
on:
  pull_request:
  push:

jobs:
  check_commit_conventions:
    name: Check commit conventions
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v2
        with:
          fetch-depth: 0
      - name: Check commit conventions
        uses: wagoid/commitlint-github-action@v2
        with:
          configFile: .commitlintrc.yml
          failOnWarnings: true
  1. Push a commit with an exclamation mark and check CI pipeline.

A commenter from another issue faced problems with the version 9.0.1 as well, although he had them with config-conventional, so it might be a separate problem.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions