-
Notifications
You must be signed in to change notification settings - Fork 29
Implement Commit Message Linting and Automation for Inventory. #73
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: develop
Are you sure you want to change the base?
Conversation
WalkthroughThis update introduces a comprehensive commit message linting and enforcement system to the project. It adds configuration for Commitlint, Husky Git hooks, and Commitizen, ensuring standardized commit messages. A new GitHub Actions workflow is set up to automatically check commit message compliance on pull requests targeting the Changes
Sequence Diagram(s)sequenceDiagram
participant Developer
participant Husky
participant Commitlint
participant GitHub Actions
Developer->>Husky: git commit
Husky->>Commitlint: Lint commit message
Commitlint-->>Husky: Pass/Fail
Husky-->>Developer: Allow/Block commit
Developer->>GitHub Actions: Open/Synchronize PR to main/develop
GitHub Actions->>Commitlint: Lint all PR commit messages
Commitlint-->>GitHub Actions: Compliance report
GitHub Actions-->>Developer: PR check result
Possibly related issues
Poem
Tip ⚡💬 Agentic Chat (Pro Plan, General Availability)
📜 Recent review detailsConfiguration used: CodeRabbit UI 📒 Files selected for processing (1)
🚧 Files skipped from review as they are similar to previous changes (1)
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. 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
There was a problem hiding this 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
🧹 Nitpick comments (5)
.gitignore (1)
26-28: Nit: Improve comment readability
For consistency with other comment blocks, add a space after#in the new section header. For example:-#Node modules +# Node modulespom.xml (1)
63-67: Optional: centralize SLF4J version
Consider defining a<slf4j.version>2.0.7</slf4j.version>property in the<properties>section and referencing it here. Centralizing the version makes future upgrades simpler and keeps dependency versions consistent.commitlint.config.js (1)
1-36: Approve commitlint rules, but ignore merge commits
The configuration correctly extends the conventional preset and enforces message structure. To avoid failures on auto-generated merge commits (e.g.,Merge pull request #...), add anignoresfunction:module.exports = { extends: ['@commitlint/config-conventional'], // Skip merge commits ignores: [(commit) => commit.startsWith('Merge ')], rules: { /* existing rules */ }, };package.json (1)
9-12: Optional: add a manual linting script
To run commitlint outside of hooks or CI, consider adding:"scripts": { "lint:commits": "commitlint --config commitlint.config.js --from=origin/main --to=HEAD" }.github/workflows/lint-commits.yml (1)
30-30: Add newline at end of file
A trailing newline satisfies the YAML lint rule and POSIX file conventions.--- a/.github/workflows/lint-commits.yml +++ b/.github/workflows/lint-commits.yml @@ -29,1 +29,2 - run: npx commitlint --from ${{ github.event.pull_request.base.sha }} --to ${{ github.event.pull_request.head.sha }} --verbose + run: npx commitlint --from ${{ github.event.pull_request.base.sha }} --to ${{ github.event.pull_request.head.sha }} --verbose +🧰 Tools
🪛 YAMLlint (1.35.1)
[error] 30-30: no new line character at the end of file
(new-line-at-end-of-file)
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
⛔ Files ignored due to path filters (1)
package-lock.jsonis excluded by!**/package-lock.json
📒 Files selected for processing (6)
.github/workflows/lint-commits.yml(1 hunks).gitignore(1 hunks).husky/commit-msg(1 hunks)commitlint.config.js(1 hunks)package.json(1 hunks)pom.xml(1 hunks)
🧰 Additional context used
🪛 YAMLlint (1.35.1)
.github/workflows/lint-commits.yml
[error] 30-30: no new line character at the end of file
(new-line-at-end-of-file)
🔇 Additional comments (9)
pom.xml (1)
63-67: Addition ofslf4j-simpleis appropriate
The newslf4j-simpledependency (v2.0.7) matches theslf4j-apiversion and, combined with the exclusion of Spring Boot’s default logging, ensures a consistent logging implementation.package.json (2)
2-8: Approve devDependencies setup
The selected versions of@commitlint,commitizen,cz-conventional-changelog, andhuskyare appropriate to enforce commit message linting and interactive commit prompts.
1-18: Verify CI workflow inclusion
Thispackage.jsonconfigures local hooks, but please confirm that the GitHub Actions workflow file (e.g.,.github/workflows/lint-commits.yml) has been added to enforce commit message linting on PRs againstmain/develop..github/workflows/lint-commits.yml (6)
1-2: Workflow name is descriptive
Thename: Commit Complianceclearly communicates the workflow’s purpose and aligns with its functionality.
3-7: Trigger events are correctly scoped
Listening onopened,synchronize, andreopenedformainanddevelopensures PRs are validated at the right times and branches.
13-18: Checkout step fetches full history
Settingfetch-depth: 0is essential socommitlintcan analyze all commits in the PR, not just the most recent one.
20-25: Node.js environment setup is optimal
Usingactions/setup-node@v4with Node.js 18 and npm caching speeds up installs while ensuring compatibility with the tooling.
26-28: Dependency installation includes devDependencies
Runningnpm ci --legacy-peer-depsinstalls both production and development deps (including@commitlint/cli), which is necessary for linting commits.
29-30: Commitlint validation command is accurate
The--fromand--toflags correctly scope the commit range between the PR’s base and head, ensuring all new commits are checked.🧰 Tools
🪛 YAMLlint (1.35.1)
[error] 30-30: no new line character at the end of file
(new-line-at-end-of-file)
|
@drtechie can you please review the changes ? |
|



📋 Description
Github Issues: Fixes PSMRI/AMRIT#82
This PR introduces commit message standardization for the Inventory-API project by setting up Commitlint, Husky, and Commitizen. The goal is to enforce a consistent commit message format across the repository to improve collaboration, readability, and enable automation (like changelogs and versioning) in the future.
These tools are now fully integrated:
4.GitHub Actions validate commit messages for all pull requests
✅ Type of Change
⚙️ Config change (configuration file or build script updates)
ℹ️ Additional Information
Changes Overview
Added Configuration Files
Dependencies Added
Package.json Updates
Testing Completed
Changes Overview
Summary
New Features
Chores
Summary by CodeRabbit