Skip to content

Commit

Permalink
chore: add & configure commitlint to validate commit messages (analog…
Browse files Browse the repository at this point in the history
  • Loading branch information
umairhm authored Aug 20, 2022
1 parent 7605f1e commit d073155
Show file tree
Hide file tree
Showing 6 changed files with 408 additions and 27 deletions.
3 changes: 3 additions & 0 deletions .githooks/commit-msg
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#!/bin/sh

npx --no -- commitlint --edit $1
Empty file modified .githooks/pre-commit
100644 → 100755
Empty file.
17 changes: 17 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,23 @@ env:
NODE_OPTIONS: --max-old-space-size=6144

jobs:
commitlint:
runs-on: ubuntu-latest
permissions:
actions: read
contents: read
# Required by wagoid/commitlint-github-action
pull-requests: read
steps:
- uses: actions/checkout@v3
with:
# Required by wagoid/commitlint-github-action
fetch-depth: 0
- name: Lint commit messages
uses: wagoid/commitlint-github-action@v5
with:
failOnWarnings: true
helpURL: https://github.com/analogjs/analog/blob/main/CONTRIBUTING.md#-commit-message-guidelines
checks:
runs-on: ubuntu-latest
steps:
Expand Down
8 changes: 8 additions & 0 deletions commitlint.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
module.exports = {
extends: ['@commitlint/config-conventional'],
rules: {
'body-leading-blank': [2, 'always'],
'footer-leading-blank': [2, 'always'],
'scope-enum': [2, 'always', ['vite-angular-plugin', 'create-analog']],
},
};
2 changes: 2 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,8 @@
"@angular/cli": "~14.0.0",
"@angular/compiler-cli": "~14.0.0",
"@angular/language-service": "~14.0.0",
"@commitlint/cli": "^17.0.3",
"@commitlint/config-conventional": "^17.0.3",
"@ngtools/webpack": "~14.0.0",
"@nrwl/cli": "14.4.2",
"@nrwl/cypress": "14.4.2",
Expand Down
Loading

0 comments on commit d073155

Please sign in to comment.