conventional-changelog / commitlint

📓 Lint commit messages
https://commitlint.js.org
MIT License
16.93k stars 912 forks source link

Support linting from the last tag #4110

Closed benquarmby closed 3 months ago

benquarmby commented 3 months ago

Description

Resolves #2507, which has the full problem statement. Also fixed a bug with the --last option.

~In draft mode to get the discussion going. Will open it up for real after more thorough testing.~ Testing complete (see below) and this is now ready to review.

Motivation and Context

See #2507.

Note that if there are no tags, such as in a brand new repo, commitlint will always pass. The idea is that it should be possible to add commitlint --from-last-tag to CI at the very beginning of a repo and never remove it. There is no need to document special steps, like adding an initial tag.

Usage examples

commitlint --from-last-tag

How Has This Been Tested?

Unit tests and locally against this repo:

yarn run commitlint --from-last-tag --verbose
Output ![from-last-tag](https://github.com/user-attachments/assets/2a4dc44b-ae05-47c9-8421-c46df78eb995)

Types of changes

Checklist:

codesandbox-ci[bot] commented 3 months ago

This pull request is automatically built and testable in CodeSandbox.

To see build info of the built libraries, click here or the icon next to each commit SHA.

escapedcat commented 3 months ago

Thanks for the comments!

escapedcat commented 3 months ago

Once this is rebased it can be merged and a release can be done. Might take a couple of days.