Skip to content

chore(commitlint): add commit-msg hook and workflow validation#368

Open
DurgaPrasad-54 wants to merge 3 commits intoPSMRI:mainfrom
DurgaPrasad-54:feat/commitlint-setup
Open

chore(commitlint): add commit-msg hook and workflow validation#368
DurgaPrasad-54 wants to merge 3 commits intoPSMRI:mainfrom
DurgaPrasad-54:feat/commitlint-setup

Conversation

@DurgaPrasad-54
Copy link
Contributor

@DurgaPrasad-54 DurgaPrasad-54 commented Mar 5, 2026

📋 Description

JIRA ID:

Updated the commit message validation setup by defining the commit rules directly in commitlint.config.js instead of extending @commitlint/config-conventional.


✅ Type of Change

  • 🐞 Bug fix (non-breaking change which resolves an issue)
  • New feature (non-breaking change which adds functionality)
  • 🔥 Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • 🛠 Refactor (change that is neither a fix nor a new feature)
  • ⚙️ Config change (configuration file or build script updates)
  • 📚 Documentation (updates to docs or readme)
  • 🧪 Tests (adding new or updating existing tests)
  • 🎨 UI/UX (changes that affect the user interface)
  • 🚀 Performance (improves performance)
  • 🧹 Chore (miscellaneous changes that don't modify src or test files)

ℹ️ Additional Information

Please describe how the changes were tested, and include any relevant screenshots, logs, or other information that provides additional context.

Summary by CodeRabbit

  • Chores
    • Restructured development tooling by migrating from Husky-based git hooks to native git hooks configuration.
    • Simplified commit message linting setup and removed unnecessary project root configuration files.
    • Updated CI/CD workflow for improved commit message validation across pull requests.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Mar 5, 2026

📝 Walkthrough

Walkthrough

This change replaces Husky-based git hooks with native .git-hooks directory, removes the project's package.json and all npm tooling, updates the CI workflow for shell-based commit validation, and simplifies the commitlint configuration by removing the extends property.

Changes

Cohort / File(s) Summary
Git Hooks Migration
.git-hooks/commit-msg, .husky/commit-msg, .husky/pre-commit
Introduced native .git-hooks/commit-msg script invoking commitlint via npx; removed Husky hook files (commit-msg and pre-commit).
Workflow Updates
.github/workflows/commit-lint.yml
Renamed workflow, updated Node.js to version 20, replaced npm commitlint invocation with manual shell-based validation loop that processes each commit in the PR range.
Configuration Changes
commitlint.config.js, package.json
Removed extends property from commitlint config; deleted entire package.json (including dependencies, scripts, and tooling configuration).
Documentation
README.md
Simplified hook setup instructions by replacing detailed Node.js setup steps with single git hooks path configuration command.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Poem

🐰 From Husky's nest we hop away,
To native hooks that save the day,
No package chains to weigh us down,
Just .git-hooks in our town,
Simpler scripts make commits bright! ✨

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The PR title accurately reflects the main changes: adding a commit-msg hook (.git-hooks/commit-msg) and updating workflow validation (.github/workflows/commit-lint.yml). The title is concise and specific.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

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

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In @.git-hooks/commit-msg:
- Around line 1-4: Update the commit hook file so it has executable permissions
(mode 100755) — run chmod +x on the script in repo and commit the permission
change; inside the script (which starts with the shebang "#!/bin/sh" and runs
"npx --yes `@commitlint/cli` --edit \"$1\"") optionally add a quick Node/npm/npx
availability check at the top to print a clearer error if npx is missing before
invoking the command.

In @.github/workflows/commit-lint.yml:
- Around line 22-29: CI pins `@commitlint/cli`@20.4.3 but the local hook
(.git-hooks/commit-msg) uses an unpinned npx invocation, causing version drift;
update the commit hook to use the same pinned version by changing its npx call
to reference `@commitlint/cli`@20.4.3 (the same package/version used in the
workflow) so commitlint behavior is identical locally and in CI.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 9ac257c4-e9b9-4c9f-aabb-e887b74a212b

📥 Commits

Reviewing files that changed from the base of the PR and between 4b44045 and 98f0ff6.

⛔ Files ignored due to path filters (1)
  • package-lock.json is excluded by !**/package-lock.json
📒 Files selected for processing (7)
  • .git-hooks/commit-msg
  • .github/workflows/commit-lint.yml
  • .husky/commit-msg
  • .husky/pre-commit
  • README.md
  • commitlint.config.js
  • package.json
💤 Files with no reviewable changes (3)
  • .husky/commit-msg
  • package.json
  • .husky/pre-commit

@sonarqubecloud
Copy link

sonarqubecloud bot commented Mar 5, 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