Skip to content

Commit

Permalink
ci: Add Conventional Commits linter for CI
Browse files Browse the repository at this point in the history
  • Loading branch information
KingMob committed May 6, 2024
1 parent d218e25 commit ba163ad
Show file tree
Hide file tree
Showing 4 changed files with 788 additions and 307 deletions.
38 changes: 38 additions & 0 deletions .github/workflows/commit-linter.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
name: commit-linter

on:
pull_request:
push:
branches: [main]

jobs:
commit-lint:
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0

- uses: actions/setup-node@v4
with:
node-version: 20
case: 'pnpm'

- name: Install commitlint
run: |
pnpm install --frozen-lockfile
- name: Print versions
run: |
git --version
node --version
pnpm --version
pnpm exec commitlint --version
- name: Validate current commit (last commit) with commitlint
if: github.event_name == 'push'
run: pnpm exec commitlint --last --verbose

- name: Validate PR commits with commitlint
if: github.event_name == 'pull_request'
run: pnpm exec commitlint --from ${{ github.event.pull_request.head.sha }}~${{ github.event.pull_request.commits }} --to ${{ github.event.pull_request.head.sha }} --verbose
6 changes: 6 additions & 0 deletions commitlint.config.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
export default {
extends: ['@commitlint/config-conventional'],
rules: {
'subject-case': [2, 'always', 'sentence-case'] // override default
}
};
8 changes: 5 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@
"react-vega": "^7.6.0",
"tabler-icons-react": "^1.55.0",
"use-editable": "^2.3.3",
"vega": "^5.22.1",
"vega-lite": "^5.6.0"
"vega": "^5.28.0",
"vega-lite": "^5.18.0"
},
"peerDependencies": {
"@emotion/react": "^11.10.4",
Expand Down Expand Up @@ -45,7 +45,9 @@
"husky": "^8.0.1",
"prettier": "2.7.1",
"storybook": "^8.0.9",
"typescript": "^4.8.4"
"typescript": "^4.9.5",
"@commitlint/cli": "^19.3.0",
"@commitlint/config-conventional": "^19.2.2"
},
"scripts": {
"clean": "scripts/clean.sh",
Expand Down
Loading

0 comments on commit ba163ad

Please sign in to comment.