데이터 파이프라인 이식
This commit is contained in:
6
git-hooks/pre-commit
Normal file
6
git-hooks/pre-commit
Normal file
@@ -0,0 +1,6 @@
|
||||
#!/bin/sh
|
||||
# git-hooks/pre-commit
|
||||
# Git이 실행하는 파일 (확장자 없음, sh 헤더 필요)
|
||||
|
||||
powershell.exe -ExecutionPolicy Bypass -File "./git-hooks/pre-commit.ps1"
|
||||
exit $?
|
||||
49
git-hooks/pre-commit.ps1
Normal file
49
git-hooks/pre-commit.ps1
Normal file
@@ -0,0 +1,49 @@
|
||||
# git-hooks/pre-commit.ps1
|
||||
|
||||
Write-Host "🔍 Pre-commit: Validating game data..." -ForegroundColor Cyan
|
||||
|
||||
# 변경된 CSV 파일 확인
|
||||
$changedFiles = git diff --cached --name-only --diff-filter=ACM
|
||||
$CSVFiles = $changedFiles | Where-Object { $_ -match "GameData/.*\.csv$" }
|
||||
|
||||
if ($CSVFiles.Count -eq 0) {
|
||||
Write-Host "ℹ️ 변경된 CSV 파일이 없습니다." -ForegroundColor Gray
|
||||
exit 0
|
||||
}
|
||||
|
||||
Write-Host "📊 검증할 파일:" -ForegroundColor Yellow
|
||||
$CSVFiles | ForEach-Object { Write-Host " - $_" }
|
||||
Write-Host ""
|
||||
|
||||
# Python 설치 확인
|
||||
$pythonCmd = Get-Command python -ErrorAction SilentlyContinue
|
||||
if (-not $pythonCmd) {
|
||||
Write-Host "❌ Python이 설치되어 있지 않습니다." -ForegroundColor Red
|
||||
Write-Host "💡 https://www.python.org/downloads/ 에서 Python을 설치하세요." -ForegroundColor Yellow
|
||||
exit 1
|
||||
}
|
||||
|
||||
# 검증 스크립트 실행
|
||||
Push-Location DataTools
|
||||
|
||||
try {
|
||||
python validate_data.py
|
||||
$exitCode = $LASTEXITCODE
|
||||
|
||||
Pop-Location
|
||||
|
||||
if ($exitCode -ne 0) {
|
||||
Write-Host ""
|
||||
Write-Host "❌ 데이터 검증 실패!" -ForegroundColor Red
|
||||
Write-Host "💡 CSV 파일을 수정 후 다시 커밋해주세요." -ForegroundColor Yellow
|
||||
exit 1
|
||||
}
|
||||
|
||||
Write-Host "✅ 데이터 검증 통과!" -ForegroundColor Green
|
||||
exit 0
|
||||
}
|
||||
catch {
|
||||
Pop-Location
|
||||
Write-Host "❌ 검증 중 오류 발생: $_" -ForegroundColor Red
|
||||
exit 1
|
||||
}
|
||||
Reference in New Issue
Block a user