refactor: 셔틀 버스 API 리팩토링 #748
Workflow file for this run
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Flyway Dangerous SQL Validator | |
| # 블루/그린 배포 환경에서 기존 WAS와 DB의 스키마 불일치하는 오류를 방지한다. | |
| on: | |
| pull_request: | |
| paths: | |
| - "**" | |
| jobs: | |
| check-flyway-dangerous-sql: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v3 | |
| with: | |
| fetch-depth: 0 | |
| - name: Validate Dangerous SQL and Non-Flyway Changes | |
| run: | | |
| BASE=${{ github.event.pull_request.base.sha }} | |
| HEAD=${{ github.event.pull_request.head.sha }} | |
| CHANGED_FILES=$(git diff --name-only "$BASE" "$HEAD") | |
| NON_FLYWAY_FILES_CHANGES=$(echo "$CHANGED_FILES" \ | |
| | grep -v '^src/main/resources/db/migration/' || true) | |
| echo "🔍 변경된 Flyway SQL 파일 검사 중..." | |
| DANGEROUS_FOUND=0 | |
| for file in $(git diff --name-only "$BASE" "$HEAD" -- src/main/resources/db/migration/*.sql); do | |
| ADDED_SQL=$(git diff "$BASE" "$HEAD" -- "$file" \ | |
| | grep -i -wE "^\+.*\b(DROP|TRUNCATE|RENAME|CHANGE)\b" || true) | |
| if [[ -n "$ADDED_SQL" ]]; then | |
| echo "::error::⚠️ 위험 SQL 감지됨" | |
| echo "파일: $file" | |
| echo "$ADDED_SQL" | sed 's/^/ /' | |
| DANGEROUS_FOUND=1 | |
| fi | |
| done | |
| if [[ "$DANGEROUS_FOUND" -eq 1 && -n "$NON_FLYWAY_FILES_CHANGES" ]]; then | |
| echo "" | |
| echo "::error::블루그린 배포에서 스키마 충돌로 인해 서버 안정성을 보장할 수 없습니다." | |
| exit 1 | |
| fi |