From bdcb834795adea4e3255faff4d17ae8408a00642 Mon Sep 17 00:00:00 2001 From: coehgns Date: Sun, 11 May 2025 20:30:18 +0900 Subject: [PATCH 1/4] =?UTF-8?q?refactor=20(=20#15=20)=20:=20pre-commit?= =?UTF-8?q?=EC=97=90=EC=84=9C=20=EC=BB=A4=EB=B0=8B=20=EB=A9=94=EC=8B=9C?= =?UTF-8?q?=EC=A7=80=20=EA=B2=80=EC=A6=9D=20=EB=A1=9C=EC=A7=81=20=EC=82=AD?= =?UTF-8?q?=EC=A0=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/hooks/pre-commit | 27 +++++---------------------- 1 file changed, 5 insertions(+), 22 deletions(-) diff --git a/.github/hooks/pre-commit b/.github/hooks/pre-commit index 3e0a1e59..3d451ccc 100755 --- a/.github/hooks/pre-commit +++ b/.github/hooks/pre-commit @@ -1,28 +1,11 @@ #!/bin/bash +# .git/hooks/pre-commit -# Git 디렉토리 위치 -git_dir=$(git rev-parse --git-dir 2>/dev/null) || { echo "❌ Git 저장소만 지원한다."; exit 1; } +echo "🔨 Gradle 빌드 검증…" -# 방금 작성된 커밋 메시지 읽기 -commit_msg="$(< "$git_dir/COMMIT_EDITMSG")" - -# 메시지 패턴 정의 -regex="^(feat|fix|chore|docs|style|refactor|test|perf|ci|build|revert) *\([[:space:]]*#[[:space:]]*[0-9]+[[:space:]]*\) *: .+$" - -if [[ "$commit_msg" =~ $regex ]]; then - echo "✅ 커밋 메시지 형식이 올바릅니다." -else - echo "❌ 커밋 메시지 형식이 잘못되었습니다." - echo " 형식: 타입(#이슈번호) : 설명" - exit 1 -fi - -# 기존에 하던 Gradle 빌드 검증도 이어서 실행 -echo "Gradle 빌드 검증 시작..." if ! ./gradlew clean build --no-daemon; then - echo "❌ 빌드 실패! 커밋 중단." + echo "❌ 빌드 실패—커밋 중단" exit 1 -else - echo "✅ 빌드 성공! 커밋 계속." - exit 0 fi + +echo "✅ 빌드 성공" From a727fa2ee0df7e6e91c71f59d27f00e48f686608 Mon Sep 17 00:00:00 2001 From: coehgns Date: Sun, 11 May 2025 20:30:47 +0900 Subject: [PATCH 2/4] =?UTF-8?q?feat=20(=20#15=20)=20:=20commit-msg=20?= =?UTF-8?q?=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/hooks/commit-msg | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100644 .github/hooks/commit-msg diff --git a/.github/hooks/commit-msg b/.github/hooks/commit-msg new file mode 100644 index 00000000..f2dcd276 --- /dev/null +++ b/.github/hooks/commit-msg @@ -0,0 +1,14 @@ +#!/bin/bash +# .git/hooks/commit-msg + +msg_file="$1" +commit_msg="$(<"$msg_file")" + +regex='^(feat|fix|chore|docs|style|refactor|test|perf|ci|build|revert) \( \#\d+ \) : .+$' + +if [[ ! $commit_msg =~ $regex ]]; then + echo "❌ 메시지 형식 에러: 타입 ( #이슈 ) : 설명" + exit 1 +fi + +echo "✅ 커밋 메시지 형식 OK" From a130b1a277282743491904216efbc61ae8c77873 Mon Sep 17 00:00:00 2001 From: coehgns Date: Sun, 11 May 2025 20:35:18 +0900 Subject: [PATCH 3/4] =?UTF-8?q?refactor=20(#15)=20:=20commit-msg=20?= =?UTF-8?q?=EC=A0=95=EA=B7=9C=EC=8B=9D=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/hooks/commit-msg | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) mode change 100644 => 100755 .github/hooks/commit-msg diff --git a/.github/hooks/commit-msg b/.github/hooks/commit-msg old mode 100644 new mode 100755 index f2dcd276..fea10cfa --- a/.github/hooks/commit-msg +++ b/.github/hooks/commit-msg @@ -4,7 +4,7 @@ msg_file="$1" commit_msg="$(<"$msg_file")" -regex='^(feat|fix|chore|docs|style|refactor|test|perf|ci|build|revert) \( \#\d+ \) : .+$' +regex="^(feat|fix|chore|docs|style|refactor|test|perf|ci|build|revert) *\([[:space:]]*#[[:space:]]*[0-9]+[[:space:]]*\) *: .+$" if [[ ! $commit_msg =~ $regex ]]; then echo "❌ 메시지 형식 에러: 타입 ( #이슈 ) : 설명" From 690639e7bfb08e7472fca678bb405d117d6a8659 Mon Sep 17 00:00:00 2001 From: coehgns Date: Sun, 11 May 2025 20:41:13 +0900 Subject: [PATCH 4/4] =?UTF-8?q?refactor=20(=20#15=20)=20:=20commit-msg=20?= =?UTF-8?q?=EC=A0=95=EA=B7=9C=EC=8B=9D=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/hooks/commit-msg | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/hooks/commit-msg b/.github/hooks/commit-msg index fea10cfa..af511a16 100755 --- a/.github/hooks/commit-msg +++ b/.github/hooks/commit-msg @@ -4,7 +4,7 @@ msg_file="$1" commit_msg="$(<"$msg_file")" -regex="^(feat|fix|chore|docs|style|refactor|test|perf|ci|build|revert) *\([[:space:]]*#[[:space:]]*[0-9]+[[:space:]]*\) *: .+$" +regex="^(feat|fix|chore|docs|style|refactor|test|perf|ci|build|revert) \\( #[0-9]+ \\) : .+$" if [[ ! $commit_msg =~ $regex ]]; then echo "❌ 메시지 형식 에러: 타입 ( #이슈 ) : 설명"