-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathlefthook.yml
More file actions
75 lines (68 loc) · 2.64 KB
/
lefthook.yml
File metadata and controls
75 lines (68 loc) · 2.64 KB
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
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
assert_lefthook_installed: true
colors: true
output:
- success
- failure
- execution
- execution_out
prepare-commit-msg:
parallel: false
commands:
validate-branch-name:
skip:
- merge
- rebase
- run: '[ -z "$TERM" ] || [ "$TERM" = "dumb" ]'
run: |
branch_name=$(git rev-parse --abbrev-ref HEAD 2>/dev/null)
if [[ "$branch_name" == "HEAD" ]]; then
echo "⚠️ Репозиторий пуст или вы делаете первый коммит без ветки. Пропускаем проверку имени ветки."
exit 0
fi
if echo "$branch_name" | grep -Eq '^main$'; then
echo "✅ Имя ветки корректно: $branch_name"
elif echo "$branch_name" | grep -Eq '^(feature|chore|fix)/[^/]+$'; then
echo "✅ Имя ветки корректно: $branch_name"
else
echo "❌ Ошибка!\nНекорректное имя ветки: $branch_name\nВетка может иметь следующие названия:\n - main\n - feature/название ветки\n - fix/название ветки\n - chore/название ветки"
exit 1
fi
commitizen:
interactive: true
skip:
- merge
- rebase
- run: '[ -z "$TERM" ] || [ "$TERM" = "dumb" ]'
run: npx cz --hook
env:
LEFTHOOK: '0'
commit-msg:
parallel: false
commands:
commitlint:
skip:
- merge
- rebase
run: yarn run commitlint --edit {1}
pre-push:
parallel: true
commands:
validate-branch-name:
run: |
branch_name=$(git rev-parse --abbrev-ref HEAD 2>/dev/null)
if [[ "$branch_name" == "HEAD" ]]; then
echo "⚠️ Репозиторий пуст или вы делаете первый коммит без ветки. Пропускаем проверку имени ветки."
exit 0
fi
if echo "$branch_name" | grep -Eq '^main$'; then
echo "✅ Имя ветки корректно: $branch_name"
elif echo "$branch_name" | grep -Eq '^(feature|chore|fix)/[^/]+$'; then
echo "✅ Имя ветки корректно: $branch_name"
else
echo "❌ Ошибка!\nНекорректное имя ветки: $branch_name\nВетка может иметь следующие названия:\n - main\n - feature/название ветки\n - fix/название ветки\n - chore/название ветки"
exit 1
fi
eslint:
run: npx yarn eslint .
type-check:
run: npx yarn tsc --noEmit