-
Notifications
You must be signed in to change notification settings - Fork 45
feat(commit): setup Husky, Commitlint,Commitzen #187
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?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
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 |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -36,3 +36,5 @@ hs_err_pid89928.log | |
|
||
# Properties | ||
src/main/environment/common_local.properties | ||
node_modules/ | ||
.history/ |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
npx --no -- commitlint --edit $1 | ||
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
#!/usr/bin/env sh | ||
. "$(dirname -- "$0")/_/husky.sh" | ||
|
||
npx --no -- commitlint --edit ${1} | ||
Comment on lines
+1
to
+4
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Incorrect hook type for commitlint command There appears to be a hook type mismatch. This file is named Pre-commit hooks run before the commit message is created and are intended for code quality checks like linting and testing. The commit message (${1}) isn't available at this pre-commit stage. For proper implementation:
#!/usr/bin/env sh
. "$(dirname -- "$0")/_/husky.sh"
-npx --no -- commitlint --edit ${1}
+npx lint-staged And ensure you have a separate #!/usr/bin/env sh
. "$(dirname -- "$0")/_/husky.sh"
npx --no -- commitlint --edit ${1} |
Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
@@ -1,43 +1,78 @@ | ||||||||||||||||||||||||||||||||||
# AMRIT - Common Service | ||||||||||||||||||||||||||||||||||
[](https://www.gnu.org/licenses/gpl-3.0)  | ||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||
Common API is a microservice whch acts as a gateway for AMRIT. There are many APIs that are exposed by Common-API. It contains APIs of common integrators like c-Zentrix, Everwell, Openkm and some master APIs like location master, alerts, notification,language and location messages. | ||||||||||||||||||||||||||||||||||
### Primary Features | ||||||||||||||||||||||||||||||||||
* Beneficiary Registration | ||||||||||||||||||||||||||||||||||
* User authorisation and authentication | ||||||||||||||||||||||||||||||||||
* Call handling (107,1097 & mcts) | ||||||||||||||||||||||||||||||||||
* Covid Vaccine status | ||||||||||||||||||||||||||||||||||
* Email Service | ||||||||||||||||||||||||||||||||||
* SMS Service | ||||||||||||||||||||||||||||||||||
* OTP Service | ||||||||||||||||||||||||||||||||||
* Feedback service | ||||||||||||||||||||||||||||||||||
* Beneficiary Medical History maintenance | ||||||||||||||||||||||||||||||||||
* Finding Institutions | ||||||||||||||||||||||||||||||||||
* KM file management | ||||||||||||||||||||||||||||||||||
* Fetching data from POCT devices | ||||||||||||||||||||||||||||||||||
* Report APIs | ||||||||||||||||||||||||||||||||||
* Language API | ||||||||||||||||||||||||||||||||||
* Notification service | ||||||||||||||||||||||||||||||||||
* CRM Reports | ||||||||||||||||||||||||||||||||||
* Appointment Scheduling | ||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||
# AMRIT - COMMON-PAI Service | ||||||||||||||||||||||||||||||||||
[](https://www.gnu.org/licenses/gpl-3.0)  | ||||||||||||||||||||||||||||||||||
COMMON-PAI (Fast Healthcare Interoperability Resources) standard defines how healthcare information can be exchanged between different computer systems regardless of how it is stored in those systems. COMMON-PAI provides a means for representing and sharing information among clinicians and organizations in a standard way regardless of the ways local EHRs represent or store the data. COMMON-PAI combines the best features of previous standards into a common specification, while being flexible enough to meet needs of a wide variety of use cases within the healthcare ecosystem. Resources are the basis for all exchangeable COMMON-PAI content. Each resource includes a standard definition and human-readable descriptions about how to use the resource. Each resource also has a set of common and resource-specific metadata (attributes) to allow its use clearly and unambiguously. COMMON-PAI Resources can store and/or exchange many types of clinical and administrative data. | ||||||||||||||||||||||||||||||||||
In AMRIT, currently we have developed 9 resources out of 27 resources. Contributors are working on developing rest of the 18 resources which will make AMRIT to be compliant with ABDM guidelines. COMMON-PAI R4 is the latest version which we are migrating from HL7 V2.0 current version of AMRIT application. | ||||||||||||||||||||||||||||||||||
### Key APIs in COMMON-PAI service | ||||||||||||||||||||||||||||||||||
* Care Context Services | ||||||||||||||||||||||||||||||||||
* e-Aushadhi | ||||||||||||||||||||||||||||||||||
* ABHA Card Services | ||||||||||||||||||||||||||||||||||
* OP Consultation Record Sharing | ||||||||||||||||||||||||||||||||||
* Diagnostic Report Record Sharing | ||||||||||||||||||||||||||||||||||
* Prescription Record Sharing | ||||||||||||||||||||||||||||||||||
* Higher Health Facility | ||||||||||||||||||||||||||||||||||
Comment on lines
+5
to
+12
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. π οΈ Refactor suggestion Adjust heading level and improve content hierarchy The βKey APIs in COMMON-PAI serviceβ section uses an H3 ( - ### Key APIs in COMMON-PAI service
+ ## Key APIs in COMMON-PAI service π Committable suggestion
Suggested change
π§° Toolsπͺ markdownlint-cli2 (0.17.2)5-5: Heading levels should only increment by one level at a time (MD001, heading-increment) |
||||||||||||||||||||||||||||||||||
## Environment and Setup | ||||||||||||||||||||||||||||||||||
For setting up the development environment, please refer to the [Developer Guide](https://piramal-swasthya.gitbook.io/amrit/developer-guide/development-environment-setup) . | ||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||
## API Guide | ||||||||||||||||||||||||||||||||||
Detailed information on API endpoints can be found in the [API Guide](https://piramal-swasthya.gitbook.io/amrit/architecture/api-guide). | ||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||
## Usage | ||||||||||||||||||||||||||||||||||
All features have been exposed as REST endpoints. Refer to the SWAGGER API specification for details. | ||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||
## Filing Issues | ||||||||||||||||||||||||||||||||||
## Setting Up Commit Hooks | ||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||
This project uses Git hooks to enforce consistent code quality and commit message standards. Even though this is a Java project, the hooks are powered by Node.js. Follow these steps to set up the hooks locally: | ||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||
If you encounter any issues, bugs, or have feature requests, please file them in the [main AMRIT repository](https://github.com/PSMRI/AMRIT/issues). Centralizing all feedback helps us streamline improvements and address concerns efficiently. | ||||||||||||||||||||||||||||||||||
### Prerequisites | ||||||||||||||||||||||||||||||||||
- Node.js (v14 or later) | ||||||||||||||||||||||||||||||||||
- npm (comes with Node.js) | ||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||
### Setup Steps | ||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||
1. **Install Node.js and npm** | ||||||||||||||||||||||||||||||||||
- Download and install from [nodejs.org](https://nodejs.org/) | ||||||||||||||||||||||||||||||||||
- Verify installation with: | ||||||||||||||||||||||||||||||||||
``` | ||||||||||||||||||||||||||||||||||
node --version | ||||||||||||||||||||||||||||||||||
npm --version | ||||||||||||||||||||||||||||||||||
``` | ||||||||||||||||||||||||||||||||||
2. **Install dependencies** | ||||||||||||||||||||||||||||||||||
- From the project root directory, run: | ||||||||||||||||||||||||||||||||||
``` | ||||||||||||||||||||||||||||||||||
npm ci | ||||||||||||||||||||||||||||||||||
``` | ||||||||||||||||||||||||||||||||||
- This will install all required dependencies including Husky and commitlint | ||||||||||||||||||||||||||||||||||
3. **Verify hooks installation** | ||||||||||||||||||||||||||||||||||
- The hooks should be automatically installed by Husky | ||||||||||||||||||||||||||||||||||
- You can verify by checking if the `.husky` directory contains executable hooks | ||||||||||||||||||||||||||||||||||
### Commit Message Convention | ||||||||||||||||||||||||||||||||||
This project follows a specific commit message format: | ||||||||||||||||||||||||||||||||||
- Format: `type(scope): subject` | ||||||||||||||||||||||||||||||||||
- Example: `feat(login): add remember me functionality` | ||||||||||||||||||||||||||||||||||
Types include: | ||||||||||||||||||||||||||||||||||
- `feat`: A new feature | ||||||||||||||||||||||||||||||||||
- `fix`: A bug fix | ||||||||||||||||||||||||||||||||||
- `docs`: Documentation changes | ||||||||||||||||||||||||||||||||||
- `style`: Code style changes (formatting, etc.) | ||||||||||||||||||||||||||||||||||
- `refactor`: Code changes that neither fix bugs nor add features | ||||||||||||||||||||||||||||||||||
- `perf`: Performance improvements | ||||||||||||||||||||||||||||||||||
- `test`: Adding or fixing tests | ||||||||||||||||||||||||||||||||||
- `build`: Changes to build process or tools | ||||||||||||||||||||||||||||||||||
- `ci`: Changes to CI configuration | ||||||||||||||||||||||||||||||||||
- `chore`: Other changes (e.g., maintenance tasks, dependencies) | ||||||||||||||||||||||||||||||||||
Your commit messages will be automatically validated when you commit, ensuring project consistency. | ||||||||||||||||||||||||||||||||||
## Filing Issues | ||||||||||||||||||||||||||||||||||
If you encounter any issues, bugs, or have feature requests, please file them in the [main AMRIT repository](https://github.com/PSMRI/AMRIT/issues). Centralizing all feedback helps us streamline improvements and address concerns efficiently. | ||||||||||||||||||||||||||||||||||
## Join Our Community | ||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||
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. | ||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||
Expand Down | ||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||
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 |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
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], | ||
'scope-case': [2, 'always', 'lower-case'], | ||
'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', | ||
'wip' | ||
], | ||
], | ||
'scope-enum': [ | ||
2, | ||
'always', | ||
['api', 'core', 'docs', 'config', 'git-hooks'] // Added git-hooks scope | ||
] | ||
}, | ||
}; |
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.
π οΈ Refactor suggestion
Add Husky hook boilerplate header
Husky hook scripts require a shebang and sourcing of the Husky runner. Please add at the top of this file before the
npx --no -- commitlint --edit $1
line: