Skip to content

feat(commitlint): lint pull request titles - #66

Open
SaiTejasJanjur-NV wants to merge 1 commit into
dsx-ai-factory:mainfrom
SaiTejasJanjur-NV:feat/commitlint-pr-title
Open

feat(commitlint): lint pull request titles#66
SaiTejasJanjur-NV wants to merge 1 commit into
dsx-ai-factory:mainfrom
SaiTejasJanjur-NV:feat/commitlint-pr-title

Conversation

@SaiTejasJanjur-NV

@SaiTejasJanjur-NV SaiTejasJanjur-NV commented Sep 10, 2026

Copy link
Copy Markdown

Description

The commitlint action can only lint commit ranges. This adds a pr-title input that lints a supplied pull request title instead.

This cannot be expressed with the existing inputs. commitlint reads a message on stdin only when --edit, --env, --from and --to are all omitted, and the run step emits --to "$COMMITLINT_TO" unconditionally with to defaulting to HEAD. Setting to: '' does not help either: the pipe is still discarded and git history is linted instead. So the title path is a separate branch that emits no range flags.

A pull request title is attacker-controlled free text, so it is bound through the step-level env: block and never interpolated into the run body.

Compatibility

Callers that do not set pr-title are unaffected. The input defaults to '', the range path is untouched, and the pre-change and post-change step bodies produce identical output and exit codes across every existing input combination listed below.

Validation

Both the pre-change and post-change Run commitlint step bodies were extracted from the parsed action.yml and executed under the composite shell GitHub uses, bash --noprofile --norc -e -o pipefail, against @commitlint/cli@21.2.2:

  • pr-title set to a conventional title: exit 0, the title is linted
  • pr-title set to Add Some Feature: exit 1, subject-empty and type-empty
  • pr-title containing command substitution, backticks, quotes, semicolons and newlines: passed through as data, nothing executed and no file written
  • pr-title set while from is also set: the title is linted and the range is ignored
  • a failing commitlint inside the pipe fails the step: -e and pipefail abort before the branch's exit 0, so it cannot mask a failure
  • no pr-title, across no inputs, from, to, config-file and from+to, in a normal clone, a shallow clone and an initial-commit repository: byte-identical output and exit codes before and after the change
  • 12 titles run against the consumer's real config, including revert, merge, fixup!, bare-semver, acronym-leading, title-case and a 120-character header: exit codes identical to that repository's current inline invocation
  • git diff --check origin/main...HEAD

Checklist

  • I am familiar with the Contributing Guidelines.
  • New or existing tests cover these changes.
  • The documentation is up to date with these changes.

Summary by CodeRabbit

  • New Features

    • Added optional pull request title linting.
    • Pull request titles can now be checked directly without requiring full commit history.
    • Existing commit-range linting remains available when no title is provided.
  • Documentation

    • Documented pull request title and commit-range linting behavior, including checkout-depth requirements.

The action only lints commit ranges. commitlint reads a message on stdin only when --edit, --env, --from and --to are all omitted, so a title cannot be checked by setting an existing input: --to defaults to HEAD, and blanking it still routes to git history. Add a pr-title input that takes the title branch instead, bound through env so the title is never interpolated into the run body.

Signed-off-by: Sai Tejas Janjur <sjanjur@nvidia.com>
@SaiTejasJanjur-NV
SaiTejasJanjur-NV requested a review from a team as a code owner September 10, 2026 16:59
@github-actions

github-actions Bot commented Sep 10, 2026

Copy link
Copy Markdown

All contributors have signed the DCO ✍️ ✅
Posted by the DCO Assistant Lite bot.

@coderabbitai

coderabbitai Bot commented Sep 10, 2026

Copy link
Copy Markdown

Review Change StackReview Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Enterprise

Run ID: b1548856-24fe-4482-b491-735d34270e35

📥 Commits

Reviewing files that changed from the base of the PR and between 3dda6f9 and 18e6a3b.

📒 Files selected for processing (2)
  • .github/actions/commitlint/README.md
  • .github/actions/commitlint/action.yml

Included review availability: Your plan provides up to 12 included reviews per hour; 11 remain after this review.


📝 Walkthrough

Walkthrough

The commitlint action now accepts an optional pull request title. When provided, it lints the title through standard input and skips commit-range linting. The README documents this mode and its checkout-history requirements.

Changes

Commitlint title linting

Layer / File(s) Summary
Title linting flow
.github/actions/commitlint/action.yml, .github/actions/commitlint/README.md
The action adds the pr-title input. It pipes the supplied title to commitlint, ignores from and to, and documents the different checkout requirements.

Estimated code review effort: 2 (Simple) | ~10 minutes

Suggested reviewers: huaweic-nv

Merge Risk: ⚪ Minimal · up to 18e6a

This change adds optional pull-request title linting while preserving existing commit-range behavior. No actionable merge-blocking risk remains after normal checks.

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly describes the main change: adding pull request title linting to the commitlint action.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check. Docstring coverage is scoped to functions touched by this diff. Analyzed 0 functions across 0…
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches 💡 1
🛠️ Fix failing CI checks 💡
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Comment @coderabbitai help to get the list of available commands.

@SaiTejasJanjur-NV

Copy link
Copy Markdown
Author

I have read the DCO Document and I hereby sign the DCO

github-actions Bot added a commit that referenced this pull request Sep 10, 2026
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