Skip to content
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

chore: add commitlint #158

Merged
merged 3 commits into from
Aug 6, 2024
Merged
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
15 changes: 15 additions & 0 deletions .github/workflows/validate-pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ jobs:
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
fetch-depth: 0

- uses: pnpm/action-setup@v4
with:
Expand All @@ -27,6 +29,19 @@ jobs:
node-version: ${{ matrix.node-version }}
cache: 'pnpm'

- name: Install commitlint
run: |
pnpm add conventional-changelog-conventionalcommits -w
pnpm add commitlint@latest -w

- name: Validate current commit (last commit) with commitlint
if: github.event_name == 'push'
run: npx commitlint --last --verbose

- name: Validate PR commits with commitlint
if: github.event_name == 'pull_request'
run: npx commitlint --from ${{ github.event.pull_request.head.sha }}~${{ github.event.pull_request.commits }} --to ${{ github.event.pull_request.head.sha }} --verbose

- name: Install Turborepo
run: pnpm add turbo --global

Expand Down
6 changes: 6 additions & 0 deletions commitlint.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
export default {
extends: ['@commitlint/config-conventional'],
rules: {
'header-max-length': [0, 'always', 72]
}
}
5 changes: 4 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,12 @@
"be:start": "cd apps/backend && pnpm start",
"be:prod": "cd apps/backend && pnpm prod",
"be:lint": "cd apps/backend && pnpm lint",
"be:test": "cd apps/backend && pnpm test"
"be:test": "cd apps/backend && pnpm test",
"lint:lastcommit": "commitlint --from=HEAD~1 --to=HEAD"
},
"devDependencies": {
"@commitlint/cli": "19.3.0",
"@commitlint/config-conventional": "19.2.2",
"@eslint/js": "9.8.0",
"eslint": "9.8.0",
"eslint-config-prettier": "9.1.0",
Expand Down
Loading
Loading