Skip to content

Commit c6d4fcd

Browse files
committed
rename
1 parent ace43a2 commit c6d4fcd

1 file changed

Lines changed: 30 additions & 0 deletions

File tree

.github/hooks/pre-commit

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
#!/bin/bash
2+
3+
# 커밋 메시지 유효성 검증
4+
commit_msg=$(cat "$1")
5+
regex="^(feat|fix|chore|docs|style|refactor|test|perf|ci|build|revert) \([[:space:]]*#[[:space:]]*[0-9]+[[:space:]]*\) : .+$"
6+
7+
if [[ "$commit_msg" =~ $regex ]]; then
8+
echo "✅ 커밋 메시지 형식이 올바릅니다."
9+
else
10+
echo "❌ 커밋 메시지 형식이 잘못되었습니다."
11+
exit 1
12+
fi
13+
14+
# Git 루트 디렉토리 찾기
15+
if ! repo_root=$(git rev-parse --show-toplevel 2>/dev/null); then
16+
echo "❌ Git 루트 디렉토리를 찾을 수 없습니다. Git 저장소 안에서 실행해주세요."
17+
exit 1
18+
fi
19+
20+
cd "$repo_root" || exit 1
21+
22+
# Gradle 빌드 검증
23+
echo "Gradle 빌드 검증 시작..."
24+
if ! ./gradlew clean build --no-daemon; then
25+
echo "❌ 빌드 실패! 커밋이 중단됩니다."
26+
exit 1
27+
else
28+
echo "✅ 빌드 성공! 커밋 계속 진행합니다."
29+
exit 0
30+
fi

0 commit comments

Comments
 (0)