Skip to content

[C4GT Community]: Standardize Git Commit Messages using Commitlint, Husky & Commitizen for MMU-UI #63

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

Open
4 tasks
drtechie opened this issue Apr 11, 2025 · 2 comments · May be fixed by PSMRI/Scheduler-UI#47

Comments

@drtechie
Copy link
Member

drtechie commented Apr 11, 2025

Ticket Contents

Description

Implement commit message linting and automation for all contributors in the repository using Commitlint, Husky, and Commitizen. This will help enforce a consistent, readable commit history, improve collaboration, and automate changelogs in the future. This will be used across all C4GT Community repositories.

Goals & Mid-Point Milestone

Goals

  • Set up Commitlint.
  • Configure Husky to trigger commit-msg hooks.
  • Add Commitizen for structured commit prompts.
  • Configure GitHub Actions to ensure repository-level checks are added for PRs.

Setup/Installation

Refer to documentation of commitlint and commitzen

Expected Outcome

Every commit made by contributors must conform to the defined structure. Any non-compliant commit will be blocked by the Husky hook, ensuring standardized commit messages and improving automation possibilities like changelog generation and CI/CD tagging. GitHub actions must result in failure if the commits to the PR do not comply with the format.

Acceptance Criteria

  • Contributors must be able to commit locally only if they follow the stipulated format.
  • It should be easier for them to use cz command to commit easily.
  • Proper linting error shown on bad commit message.
  • GitHub Actions must be in place to ensure all PRs raised follow these formatted commits.
  • No interference with existing CI pipelines.

Implementation Details

We will use the following tools and configurations:

  • Commitlint: To enforce conventional commit messages
    Commitlint Doc

  • Husky: To add Git hooks that prevent bad commits
    Husky Doc

  • Commitizen: To prompt structured commit messages
    Commitizen Doc

Mockups/Wireframes

Not applicable for this ticket.

Product Name

AMRIT

Organisation Name

Piramal Swasthya Management and Research Institute

Domain

⁠Healthcare

Tech Skills Needed

Node.js, NPM

Mentor(s)

@drtechie

Complexity

Medium

Category

Configuration, CI/CD

@blazethunderstorm
Copy link

Hello @drtechie,

I'd love to work on this issue! Ensuring a standardized commit message workflow across this repository .

My Approach:

Set up Commitlint with a configuration enforcing conventional commit message standards.

Integrate Husky to add a commit-msg hook that blocks non-compliant commit messages.

Implement Commitizen to make it easier for contributors to create structured commit messages through an interactive CLI prompt.

Configure GitHub Actions to validate commit messages for all PRs and ensure compliance with the standards.

Verify the setup doesn't interfere with existing CI pipelines and run thorough tests.

I’ll refer to the official documentation for Commitlint, Husky, and Commitizen to ensure best practices are followed and deliver a seamless developer experience.

Looking forward to contributing and improving the workflows!

Thanks!!

@abhijeetw035
Copy link

Hi @drtechie, I'd like to solve this issue.

My approach will be -

  • Set up Commitlint with conventional rules
  • Configure Husky for commit-msg hook
  • Add Commitizen for interactive commits
  • Create a GitHub Action to enforce commit format on PRs
  • Make sure it plays nice with existing CI
  • Add brief setup instructions for contributors

Looking forward to solve this issue!!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
3 participants