Skip to content
name: Checks migration files have not been altered.
on:
push:
branches: "**"
jobs:
check_sql_migrations:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- run: git fetch origin main
- name: Check for changed SQL migration files
run: |
# Compare current branch against main branch for file changes
CHANGED_FILES=$(git diff --name-status origin/main...HEAD migrations/sql | grep '^[MDR]' | cut -f2)
if [[ ! -z "$CHANGED_FILES" ]]; then
echo "Detected changes in migrations/sql (modified, deleted, or renamed):"
echo "$CHANGED_FILES"
exit 1
else
echo "No prohibited changes in migrations/sql."
fi