-
Notifications
You must be signed in to change notification settings - Fork 943
Description
Using same commit hash for --from
and --to
flags makes commitlint do nothing and return exit-code=0 (success).
Steps to Reproduce
- Do a commit that violates your commitlint policies.
- Grab the last commit hash from your repo, e.g. with git-log.
- Run npx commitlint --verbose --from
<commitHash>
--to<commitHash>
Current Behavior
It does nothing and returns exit-code = 0 (success). This is quite misleading because it could make anyone think that the validation was successful on the last commit (especially in CI scenarios).
Expected Behavior
If commit-hash supplied for --from and --to is the same, it should just analyze one single commit message for the supplied commit hash. Or at least return an exit-code different than 0 to denote that the supplied params were invalid (invalid in the sense that commitlint didn't validate anything).
Affected packages
- cli
- core
- prompt
- config-angular
Context
I was trying to develop a simple GitHub actions CI workflow that checks the single last commit hash. The flag --edit
didn't work in this scenario so I tried --from and --to with ${{ github.sha }
but, as you can see from this bug I just filed, it didn't work.
You might want to suggest that I should use the previous commit hash for the from
flag, but I believe that in order to achieve this I probably need to tweak the actions/checkout@v2
step with a fetch-depth: 0
option; which is not ideal (because it's not easy to figure out). Fixing this bug should probably be better.
Your Environment
Executable | Version |
---|---|
commitlint --version |
@commitlint/[email protected] |
git --version |
git version 2.32.0 (Apple Git-132) |
node --version |
v18.9.0 |