forked from dev-bookclub/software-design-by-example
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcommitlint.config.js
49 lines (44 loc) · 1.26 KB
/
commitlint.config.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
export default {
rules: {
'header-match-team-pattern': [2, 'always'],
},
plugins: [
{
rules: {
'header-match-team-pattern': ({ header }) => {
// 허용된 GitHub 아이디 목록
const allowedIds = [
'dhyun2',
'kwonboryong',
'sunjoolee',
'yu-ratel',
'ksh200070',
'5622lsk',
'hoseokna',
'eunjeong90',
'jadugamja',
];
// 정규식을 사용하여 커밋 메시지 패턴 검사
const pattern = /^\[([a-zA-Z0-9_-]+)\/(\d+주차|chore)\]:\s(.+)$/;
const match = header.match(pattern);
if (!match) {
return [
false,
'커밋 메시지는 "[githubid/N주차]: 설명" 또는 "[githubid/chore]: 설명" 형식을 따라야 합니다.',
];
}
const [, githubId] = match;
if (!allowedIds.includes(githubId)) {
return [
false,
`허용되지 않은 GitHub 아이디입니다: ${githubId}. 사용 가능한 아이디: ${allowedIds.join(
', '
)}`,
];
}
return [true, ''];
},
},
},
],
};