Skip to content

Commit

Permalink
Merge pull request #2 from r34son/commitlint
Browse files Browse the repository at this point in the history
Commitlint
  • Loading branch information
r34son authored Oct 14, 2023
2 parents fa27cf5 + 280877a commit b9817a6
Show file tree
Hide file tree
Showing 5 changed files with 757 additions and 4 deletions.
23 changes: 21 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,15 @@ on:
branches: ['master']

jobs:
unit:
validate:
name: Validate
runs-on: ubuntu-latest

steps:
- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Install pnpm
uses: pnpm/action-setup@v2
Expand All @@ -26,6 +29,22 @@ jobs:
- name: Install dependencies
run: pnpm install

- name: Validate current commit (last commit) with commitlint
if: github.event_name == 'push'
run: |
pnpm exec commitlint \
--from ${{ github.event.before }} \
--to ${{ github.event.after }} \
--verbose
- name: Validate PR commits with commitlint
if: github.event_name == 'pull_request'
run: |
pnpm exec commitlint \
--from ${{ github.event.pull_request.base.sha }} \
--to ${{ github.event.pull_request.head.sha }} \
--verbose
- name: Run the tests and generate coverage report
run: pnpm test -- --coverage

Expand Down
4 changes: 4 additions & 0 deletions .husky/commit-msg
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/usr/bin/env sh
. "$(dirname -- "$0")/_/husky.sh"

pnpm run commitlint ${1}
1 change: 1 addition & 0 deletions commitlint.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
module.exports = { extends: ['@commitlint/config-conventional'] };
9 changes: 7 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,9 @@
"build": "next build",
"start": "next start",
"lint": "next lint",
"test": "jest"
"test": "jest",
"prepare": "husky install",
"commitlint": "commitlint --edit"
},
"dependencies": {
"@sentry/nextjs": "^7.74.0",
Expand All @@ -21,6 +23,8 @@
"react-dom": "^18"
},
"devDependencies": {
"@commitlint/cli": "^17.8.0",
"@commitlint/config-conventional": "^17.8.0",
"@testing-library/jest-dom": "^6.1.4",
"@testing-library/react": "^14.0.0",
"@types/jest": "^29.5.5",
Expand All @@ -31,6 +35,7 @@
"eslint-config-next": "13.5.4",
"jest": "^29.7.0",
"jest-environment-jsdom": "^29.7.0",
"typescript": "^5"
"typescript": "^5",
"husky": "^8.0.0"
}
}
Loading

0 comments on commit b9817a6

Please sign in to comment.