Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 30 additions & 0 deletions .github/workflows/commit-lint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
name: Commit Compliance

on:
pull_request:
types: [opened, synchronize, reopened]

jobs:
commitlint:
runs-on: ubuntu-latest

steps:
- name: Checkout code with submodule
uses: actions/checkout@v4
with:
ref: ${{ github.event.pull_request.head.ref }}
repository: ${{ github.event.pull_request.head.repo.full_name }}
submodules: true
fetch-depth: 0

- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: 18

- name: Install dependencies
run: npm ci --legacy-peer-deps

- name: Run commitlint on PR
run: |
npx commitlint --from ${{ github.event.pull_request.base.sha }} --to ${{ github.event.pull_request.head.sha }} --verbose
Comment on lines +1 to +30
Copy link

Choose a reason for hiding this comment

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

💡 Verification agent

🧩 Analysis chain

Verify presence of commitlint.config.js
Ensure that commitlint.config.js exists in the repository root and correctly extends @commitlint/config-conventional. You can run:

This confirms your CI and local hooks have the intended rules.


🏁 Script executed:

#!/bin/bash
# Check for commitlint config
if [[ ! -f commitlint.config.js ]]; then
  echo "Error: commitlint.config.js is missing"
  exit 1
else
  echo "commitlint.config.js found"
fi

Length of output: 96


#!/bin/bash
# Verify that commitlint.config.js extends @commitlint/config-conventional
grep -n "extends" commitlint.config.js || echo "No 'extends' key found"

🏁 Script executed:

#!/bin/bash
# Verify commitlint.config.js extends @commitlint/config-conventional
rg -n "extends\s*:\s*['\"]@commitlint/config-conventional['\"]" commitlint.config.js || echo "Error: commitlint.config.js does not extend @commitlint/config-conventional"

Length of output: 251


Add conventional commit rules to commitlint.config.js
The file exists but doesn’t extend the official conventional preset, so CI won’t enforce your team’s commit guidelines. Please update commitlint.config.js to include:

module.exports = {
  extends: ['@commitlint/config-conventional'],
  // …any custom rules here
};

• File: commitlint.config.js
• Line(s): at the top of the exported config

🧰 Tools
🪛 YAMLlint (1.35.1)

[error] 30-30: no new line character at the end of file

(new-line-at-end-of-file)


[error] 30-30: trailing spaces

(trailing-spaces)

4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -34,3 +34,7 @@ command_output.log
# Properties
src/main/environment/1097_local.properties
src/main/environment/common_local.properties

### Node.js ###
node_modules/
npm-debug.log
1 change: 1 addition & 0 deletions .husky/commit-msg
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
npx --no -- commitlint --edit $1
Copy link

Choose a reason for hiding this comment

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

⚠️ Potential issue

Use the correct npx flag and quote the commit file
The hook currently uses --no, which is not a valid npx flag and may not prevent installs. Please update to:

- npx --no -- commitlint --edit $1 
+ npx --no-install commitlint --edit "$1"

This ensures the locally installed commitlint is used without side-effect installs and handles filenames with spaces safely.

📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
npx --no -- commitlint --edit $1
npx --no-install commitlint --edit "$1"

18 changes: 17 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,22 @@ mvn spring-boot:run -P1097_identity -DENV_VAR=local

**Note:** Start the main application before running the 1097_identity profile. Each profile requires the `-DENV_VAR=local` parameter for local development.

## Commit Message Hooks

This repository uses commit message linting to ensure consistent commit messages. To use it:

1. Install dependencies:
```bash
npm install
```

2. Create commits using the interactive prompt:
```bash
npm run commit
```

The commit hook will automatically validate your commit messages against the conventional commit format.

## API Guide
Detailed information on API endpoints can be found in the [API Guide](https://piramal-swasthya.gitbook.io/amrit/architecture/api-guide).

Expand All @@ -49,6 +65,6 @@ If you encounter any issues, bugs, or have feature requests, please file them in

## Join Our Community

Wed love to have you join our community discussions and get real-time support!
We'd love to have you join our community discussions and get real-time support!
Join our [Discord server](https://discord.gg/FVQWsf5ENS) to connect with contributors, ask questions, and stay updated.

36 changes: 36 additions & 0 deletions commitlint.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
module.exports = {
extends: ['@commitlint/config-conventional'],
rules: {
'body-leading-blank': [1, 'always'],
'body-max-line-length': [2, 'always', 100],
'footer-leading-blank': [1, 'always'],
'footer-max-line-length': [2, 'always', 100],
'header-max-length': [2, 'always', 100],
'subject-case': [
2,
'never',
['sentence-case', 'start-case', 'pascal-case', 'upper-case'],
],
'subject-empty': [2, 'never'],
'subject-full-stop': [2, 'never', '.'],
'type-case': [2, 'always', 'lower-case'],
'type-empty': [2, 'never'],
'type-enum': [
2,
'always',
[
'build',
'chore',
'ci',
'docs',
'feat',
'fix',
'perf',
'refactor',
'revert',
'style',
'test'
],
],
},
};
Loading