fix: 시내버스 시간표 한기대 출발 시간 보정 #104
This file contains 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 Check | |
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: | | |
CHANGED_FILES=$( | |
git diff --name-only \ | |
${{ github.event.pull_request.base.sha }} \ | |
${{ github.event.pull_request.head.sha }} | |
) | |
NON_FLYWAY_FILES_CHANGES=$( | |
echo "$CHANGED_FILES" | grep -v '^src/main/resources/db.migration/' || true | |
) | |
DANGEROUS_SQL_COMMANDS=$( | |
git diff --unified=0 \ | |
${{ github.event.pull_request.base.sha }} \ | |
${{ github.event.pull_request.head.sha }} \ | |
-- 'src/main/resources/db.migration/**/*.sql' | \ | |
grep -i -wE "^\+.*\b(DROP|TRUNCATE|RENAME|CONSTRAINT|MODIFY|CHANGE)\b" || true | |
) | |
if [[ -n "$DANGEROUS_SQL_COMMANDS" && -n "$NON_FLYWAY_FILES_CHANGES" ]]; then | |
echo "::error:: Flyway 스크립트에서 위험한 SQL 명령어가 발견되었습니다:" | |
echo "$DANGEROUS_SQL_COMMANDS" | |
echo "::error:: Flyway 디렉토리를 제외하고 변경된 파일이 감지되었습니다:" | |
echo "$NON_FLYWAY_FILES_CHANGES" | |
exit 1 | |
fi |