Skip to content

Commit 43f6c8a

Browse files
committed
ci(Code-Quality): added configuration file for commitlint
1 parent f226d89 commit 43f6c8a

File tree

2 files changed

+140
-8
lines changed

2 files changed

+140
-8
lines changed

.github/commitlint.config.js

Lines changed: 130 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,130 @@
1+
module.exports = {
2+
parserPreset: 'conventional-changelog-conventionalcommits',
3+
rules: {
4+
'body-leading-blank': [1, 'always'],
5+
'body-max-line-length': [2, 'always', 100],
6+
'footer-leading-blank': [1, 'always'],
7+
'footer-max-line-length': [2, 'always', 100],
8+
'header-max-length': [2, 'always', 100],
9+
'subject-empty': [2, 'never'],
10+
'subject-full-stop': [2, 'never', '.'],
11+
'type-case': [2, 'always', 'lower-case'],
12+
'type-empty': [2, 'never'],
13+
'type-enum': [
14+
2,
15+
'always',
16+
[
17+
'build',
18+
'chore',
19+
'ci',
20+
'docs',
21+
'feat',
22+
'fix',
23+
'perf',
24+
'refactor',
25+
'revert',
26+
'style',
27+
'test',
28+
],
29+
],
30+
},
31+
prompt: {
32+
questions: {
33+
type: {
34+
description: "Select the type of change that you're committing",
35+
enum: {
36+
feat: {
37+
description: 'A new feature',
38+
title: 'Features',
39+
emoji: '✨',
40+
},
41+
fix: {
42+
description: 'A bug fix',
43+
title: 'Bug Fixes',
44+
emoji: '🐛',
45+
},
46+
docs: {
47+
description: 'Documentation only changes',
48+
title: 'Documentation',
49+
emoji: '📚',
50+
},
51+
style: {
52+
description:
53+
'Changes that do not affect the meaning of the code (white-space, formatting, missing semi-colons, etc)',
54+
title: 'Styles',
55+
emoji: '💎',
56+
},
57+
refactor: {
58+
description:
59+
'A code change that neither fixes a bug nor adds a feature',
60+
title: 'Code Refactoring',
61+
emoji: '📦',
62+
},
63+
perf: {
64+
description: 'A code change that improves performance',
65+
title: 'Performance Improvements',
66+
emoji: '🚀',
67+
},
68+
test: {
69+
description: 'Adding missing tests or correcting existing tests',
70+
title: 'Tests',
71+
emoji: '🚨',
72+
},
73+
build: {
74+
description:
75+
'Changes that affect the build system or external dependencies (example scopes: gulp, broccoli, npm)',
76+
title: 'Builds',
77+
emoji: '🛠',
78+
},
79+
ci: {
80+
description:
81+
'Changes to our CI configuration files and scripts (example scopes: Travis, Circle, BrowserStack, SauceLabs)',
82+
title: 'Continuous Integrations',
83+
emoji: '⚙️',
84+
},
85+
chore: {
86+
description: "Other changes that don't modify src or test files",
87+
title: 'Chores',
88+
emoji: '♻️',
89+
},
90+
revert: {
91+
description: 'Reverts a previous commit',
92+
title: 'Reverts',
93+
emoji: '🗑',
94+
},
95+
},
96+
},
97+
scope: {
98+
description:
99+
'What is the scope of this change (e.g. component or file name)',
100+
},
101+
subject: {
102+
description:
103+
'Write a short, imperative tense description of the change',
104+
},
105+
body: {
106+
description: 'Provide a longer description of the change',
107+
},
108+
isBreaking: {
109+
description: 'Are there any breaking changes?',
110+
},
111+
breakingBody: {
112+
description:
113+
'A BREAKING CHANGE commit requires a body. Please enter a longer description of the commit itself',
114+
},
115+
breaking: {
116+
description: 'Describe the breaking changes',
117+
},
118+
isIssueAffected: {
119+
description: 'Does this change affect any open issues?',
120+
},
121+
issuesBody: {
122+
description:
123+
'If issues are closed, the commit requires a body. Please enter a longer description of the commit itself',
124+
},
125+
issues: {
126+
description: 'Add issue references (e.g. "fix #123", "re #123".)',
127+
},
128+
},
129+
},
130+
};

.github/workflows/code-quality.yml

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -38,11 +38,13 @@ jobs:
3838
fail_ci_if_error: true
3939
verbose: true
4040

41-
# commitlint:
42-
# name: Commit Convention
43-
# runs-on: ubuntu-latest
44-
# steps:
45-
# - uses: actions/checkout@v3
46-
# with:
47-
# fetch-depth: 0
48-
# - uses: wagoid/commitlint-github-action@v4
41+
commitlint:
42+
name: Commit Convention
43+
runs-on: ubuntu-latest
44+
steps:
45+
- uses: actions/checkout@v3
46+
with:
47+
fetch-depth: 0
48+
- uses: wagoid/commitlint-github-action@v4
49+
with:
50+
configFile: .github/commitlint.config.js

0 commit comments

Comments
 (0)