ci: scope commitlint to PR-introduced commits, fix title suffix check - #603
Closed
MichaelTaylor3d wants to merge 1 commit into
Closed
ci: scope commitlint to PR-introduced commits, fix title suffix check#603MichaelTaylor3d wants to merge 1 commit into
MichaelTaylor3d wants to merge 1 commit into
Conversation
A develop -> main release-cut PR was linting main..develop, the full inherited commit range, instead of just the commits it introduces. Every commit in that range was already linted at its own PR while it was still mutable; re-linting it at cut time adds no information and cannot be satisfied once merged (gitlinks and rev-pinned deps make history immutable). Use commitDepth: 1 on a main-base PR; keep the full-range lint unchanged for develop-base PRs, where authors can still fix the commits. Also fix the PR-title lint's blind spot: GitHub's squash merge lands "$PR_TITLE (#$PR_NUMBER)" as the commit subject, about eight characters longer than the title alone, so a title that passes header-max-length can still produce an over-limit commit subject that nothing checks. Lint the exact string that will land. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Contributor
Author
|
This PR has been superseded by #602. The commitlint workflow fix was cherry-picked onto the The |
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
commitlinton amain-base cut PR to the commits it introduces (commitDepth: 1), not the whole inheritedmain..developrange — those commits were already linted at their own PRs while still mutable, so re-linting them at cut time adds no information and cannot be satisfied (history is now pinned by gitlinks and rev-pinned deps).develop-base PRs linting their full range unchanged — that range is still mutable and its authors can still fix it.Lint PR titlestep's blind spot: GitHub's squash merge lands"$PR_TITLE (#$PR_NUMBER)"as the commit subject, about 8 characters longer than the title alone. A title withinheader-max-length: 100could still produce an over-limit commit subject that nothing checked. Now lints the exact string that lands.Why two steps instead of one conditional input
${{ cond && 1 || 0 }}-style single-input conditionals are a real trap in Actions expression syntax —0and empty string are both falsy, so a wrong form silently disables the gate for every PR. Used two steps with mutually exclusiveif: github.base_ref == 'main'/if: github.base_ref != 'main'guards instead, each with an unambiguous literalcommitDepth. The job name (Lint commit messages) is unchanged, so this stays the same required check.Scope
Touches only
.github/workflows/commitlint.yml. No source changes, no other workflow.Test plan
main-base) exercises the newcommitDepth: 1step and the fixed title-suffix lint against its own commit/title — must pass, proving the fix isn't self-blocking.develop -> maincut PR should no longer be blocked by inherited, already-linted commits.(#NNN)suffix exceeds it should now be caught before merge.🤖 Generated with Claude Code