Skip to content

ci: scope commitlint to PR-introduced commits, fix title suffix check - #603

Closed
MichaelTaylor3d wants to merge 1 commit into
mainfrom
ci/scope-commitlint
Closed

ci: scope commitlint to PR-introduced commits, fix title suffix check#603
MichaelTaylor3d wants to merge 1 commit into
mainfrom
ci/scope-commitlint

Conversation

@MichaelTaylor3d

Copy link
Copy Markdown
Contributor

Summary

  • Scope commitlint on a main-base cut PR to the commits it introduces (commitDepth: 1), not the whole inherited main..develop range — 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).
  • Keep develop-base PRs linting their full range unchanged — that range is still mutable and its authors can still fix it.
  • Fix the Lint PR title step'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 within header-max-length: 100 could 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 — 0 and empty string are both falsy, so a wrong form silently disables the gate for every PR. Used two steps with mutually exclusive if: github.base_ref == 'main' / if: github.base_ref != 'main' guards instead, each with an unambiguous literal commitDepth. 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

  • CI run on this PR (main-base) exercises the new commitDepth: 1 step and the fixed title-suffix lint against its own commit/title — must pass, proving the fix isn't self-blocking.
  • A future develop -> main cut PR should no longer be blocked by inherited, already-linted commits.
  • A future PR whose title is within 100 chars but whose title + (#NNN) suffix exceeds it should now be caught before merge.

🤖 Generated with Claude Code

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>
@MichaelTaylor3d

Copy link
Copy Markdown
Contributor Author

This PR has been superseded by #602. The commitlint workflow fix was cherry-picked onto the release/0.256.0 branch, which already carries the v0.256.0 version bump. Folding the workflow change into #602 creates a single PR that satisfies both the commitlint check (fixed workflow) and the version increment gate (v0.256.0 bump).

The ci/scope-commitlint branch is preserved for reference if the fold needs to be re-examined.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant