diff --git a/.github/workflows/commitlint.yml b/.github/workflows/commitlint.yml new file mode 100644 index 00000000..3fe44d46 --- /dev/null +++ b/.github/workflows/commitlint.yml @@ -0,0 +1,30 @@ +name: Commit Message Lint + +on: + pull_request: + types: [opened, synchronize, edited] + +jobs: + lint-commits: + runs-on: ubuntu-latest + + steps: + - name: Checkout PR branch + uses: actions/checkout@v3 + with: + fetch-depth: 0 + + - name: Set up Node.js + uses: actions/setup-node@v3 + with: + node-version: "20" + + - name: Install dependencies + run: npm ci + + - name: Lint commit messages + uses: wagoid/commitlint-github-action@v4 + with: + from: ${{ github.base_ref }} + to: ${{ github.head_ref }} + verbose: true diff --git a/.gitignore b/.gitignore index 1538f381..3b7aea54 100644 --- a/.gitignore +++ b/.gitignore @@ -34,3 +34,5 @@ command_output.log # Properties src/main/environment/1097_local.properties src/main/environment/common_local.properties + +node_modules/ \ No newline at end of file diff --git a/.husky/commit-msg b/.husky/commit-msg new file mode 100755 index 00000000..fd2bf708 --- /dev/null +++ b/.husky/commit-msg @@ -0,0 +1 @@ +npx --no-install commitlint --edit $1 diff --git a/.husky/prepare-commit-msg b/.husky/prepare-commit-msg new file mode 100755 index 00000000..9039a44e --- /dev/null +++ b/.husky/prepare-commit-msg @@ -0,0 +1 @@ +npx --no-install cz diff --git a/commitlint.config.js b/commitlint.config.js new file mode 100644 index 00000000..fe3163ff --- /dev/null +++ b/commitlint.config.js @@ -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", + ], + ], + }, +}; diff --git a/package.json b/package.json new file mode 100644 index 00000000..0d74454f --- /dev/null +++ b/package.json @@ -0,0 +1,34 @@ +{ + "name": "identity-api", + "version": "1.0.0", + "description": "Identity API for user authentication and authorization.", + "main": "index.js", + "config": { + "commitizen": { + "path": "cz-conventional-changelog" + } + }, + "scripts": { + "test": "echo \"No tests specified\"", + "prepare": "husky install", + "commit": "cz" + }, + "repository": { + "type": "git", + "url": "git+https://github.com/PSMRI/Identity-API.git" + }, + "keywords": [], + "author": "", + "license": "ISC", + "bugs": { + "url": "https://github.com/PSMRI/Identity-API/issues" + }, + "homepage": "https://github.com/PSMRI/Identity-API#readme", + "devDependencies": { + "@commitlint/cli": "^19.8.0", + "@commitlint/config-conventional": "^19.8.0", + "commitizen": "^4.3.1", + "cz-conventional-changelog": "^3.3.0", + "husky": "^9.1.7" + } +}