Setup new bot data controller #227
Workflow file for this run
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: Alembic migrations | |
on: | |
pull_request: | |
paths: | |
- "api/database/models/**" | |
jobs: | |
check_files: | |
name: Check files | |
outputs: | |
run_job: ${{ steps.check_files.outputs.run_job }} | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v2 | |
with: | |
fetch-depth: 2 | |
- name: Is there a new migration? | |
id: check_files | |
run: | | |
echo "=============== list modified files ===============" | |
git diff --name-only HEAD^ HEAD | |
echo "========== check paths of modified files ==========" | |
git diff --name-only HEAD^ HEAD > files.txt | |
run_job=true | |
while IFS= read -r file | |
do | |
echo $file | |
if [[ $file == api/database/models/* && ! $(git diff --name-only HEAD^ HEAD | grep -q '^api/alembic/version/') ]]; then | |
echo "SQL database table models have been modified and no alembic revision was found. Please create a new revision." | |
run_job=false | |
exit 1 | |
fi | |
done < files.txt | |
echo "::set-output name=run_job::$run_job" |