Repository navigation
ci(commitlint): skip pull requests that carry no commits - #517
Merged
Merged
Conversation
When Renovate resets a branch to a main that already has its update, the
pull request's base and head point to the same commit. commitlint 21
rejects that range with exit code 9 ("--from and --to point to the same
commit"), and the step reported it as a failure (seen on #513). Count the
commits between base and head first and skip linting with a notice when
there are none.
|
The latest updates on your projects. Learn more about Vercel for GitHub. |
Contributor
There was a problem hiding this comment.
✅ No new issues found.
Reviewed changes
Reviewed the one change to the Commitlint workflow (mode: standard). It stops commitlint from failing on pull requests whose base and head are the same commit.
- Skip empty commit ranges — the "Lint commits" step now runs
git rev-list --count "$BASE_SHA..$HEAD_SHA"first. When the result is 0, it emits a::notice::and exits 0 instead of callingcommitlint, which exits 9 on that input.
Overall assessment: ready to merge. I checked these edge cases and found nothing to fix:
actions/checkoutusesfetch-depth: 0, so both SHAs are available torev-list.- If
rev-listever errored,[ "" -eq 0 ]would evaluate to false inside theif, so it does not triggerbash -e. The step would then fall through tocommitlint, so it can never pass silently. - A head that is behind base also counts 0 and is skipped. That is correct, because the PR has no commits of its own.
- The existing
reported no commits to checkbranch can still be reached, for example when the PR contains only merge commits, whichcommitlintignores by default. Keeping it is right.
claude-opus-5-5 | 𝕏
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

Summary
The Commitlint check failed on #513 (run) without any bad commit message.
Cause
Renovate reset
renovate/vite-8.x-lockfileto amainthat already had vite 8.3.6 from #514, so the pull request's base and head were the same commit (34d6568). commitlint rejects that range:GitHub then marked #513 as merged with zero commits, so that PR needs no further action.
Fix
The "Lint commits" step counts the commits between base and head first (
git rev-list --count). When there are none it ends with a::notice::instead of calling commitlint. Everything after that is unchanged.Verification
The step's script, extracted from the workflow and run locally with the same env vars:
34d6568..34d6568, the #513 shape), new stepc888ac8..34d6568)