-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: setup commitlint and husky git hooks
- Loading branch information
1 parent
95a427c
commit 067bb49
Showing
8 changed files
with
820 additions
and
37 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,105 @@ | ||
module.exports = { | ||
extends: ['@commitlint/config-conventional'], | ||
rules: { | ||
'type-enum': [ | ||
2, | ||
'always', | ||
[ | ||
'feat', | ||
'fix', | ||
'refactor', | ||
'perf', | ||
'test', | ||
'ci', | ||
'deps', | ||
'docs', | ||
'chore', | ||
'revert', | ||
'release' | ||
], | ||
], | ||
}, | ||
prompt: { | ||
questions: { | ||
type: { | ||
description: "Select the type of change that you're committing", | ||
enum: { | ||
feat: { | ||
description: 'A new feature', | ||
title: 'Features', | ||
emoji: '✨' | ||
}, | ||
fix: { | ||
description: 'A bug fix', | ||
title: 'Bug Fixes', | ||
emoji: '🐛' | ||
}, | ||
docs: { | ||
description: 'Documentation only changes', | ||
title: 'Documentation', | ||
emoji: '📚' | ||
}, | ||
refactor: { | ||
description: 'A code change that neither fixes a bug nor adds a feature (including formatting)', | ||
title: 'Code Refactoring', | ||
emoji: '📦' | ||
}, | ||
perf: { | ||
description: 'A code change that improves performance', | ||
title: 'Performance Improvements', | ||
emoji: '🚀' | ||
}, | ||
test: { | ||
description: 'Adding missing tests or correcting existing tests', | ||
title: 'Tests', | ||
emoji: '🚨' | ||
}, | ||
ci: { | ||
description: 'Changes to our CI configuration files and scripts (example scopes: Travis, Circle, BrowserStack, SauceLabs)', | ||
title: 'Continuous Integrations', | ||
emoji: '⚙️' | ||
}, | ||
deps: { | ||
description: 'Any changes in dependencies', | ||
title: 'Dependencies', | ||
emoji: '📦' | ||
}, | ||
chore: { | ||
description: "Other changes that don't modify src or test files", | ||
title: 'Chores', | ||
emoji: '♻️' | ||
}, | ||
revert: { | ||
description: 'Reverts a previous commit', | ||
title: 'Reverts', | ||
emoji: '🗑' | ||
}, | ||
release: { | ||
description: 'Release new version. DO NOT USE IT.', | ||
title: 'Release', | ||
emoji: '🚀' | ||
} | ||
} | ||
}, | ||
scope: { | ||
description: 'What is the scope of this change (e.g. component or file name)' | ||
}, | ||
subject: { | ||
description: 'Write a short, imperative tense description of the change' | ||
}, | ||
body: { description: 'Provide a longer description of the change' }, | ||
isBreaking: { description: 'Are there any breaking changes?' }, | ||
breakingBody: { | ||
description: 'A BREAKING CHANGE commit requires a body. Please enter a longer description of the commit itself' | ||
}, | ||
breaking: { description: 'Describe the breaking changes' }, | ||
isIssueAffected: { description: 'Does this change affect any open issues?' }, | ||
issuesBody: { | ||
description: 'If issues are closed, the commit requires a body. Please enter a longer description of the commit itself' | ||
}, | ||
issues: { | ||
description: 'Add issue references (e.g. "ref: #123", "ref: #123, #124".)' | ||
} | ||
} | ||
} | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -15,14 +15,24 @@ jobs: | |
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v4 | ||
with: | ||
fetch-depth: 0 | ||
|
||
- name: Set up Node.js with Cache and Install | ||
uses: ./.github/actions/install-dependencies | ||
with: | ||
node-version: '20.18.0' | ||
|
||
- name: Run linter | ||
run: npm run lint | ||
- name: Fetch main branch and run commitlint | ||
if: github.event_name == 'pull_request' | ||
run: | | ||
git fetch origin main | ||
npx commitlint --from=origin/main | ||
- name: Run linters (eslint, markdownlint) | ||
run: | | ||
npm run eslint | ||
npm run markdownlint | ||
- name: Run Hadolint on Dockerfile | ||
uses: hadolint/[email protected] | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
#!/usr/bin/env sh | ||
. "$(dirname -- "$0")/_/husky.sh" | ||
|
||
npx --no-install commitlint --edit "$1" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.