Skip to content

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

@drtechie

Description

@drtechie

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

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions