Verify Schema Update #5
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: Verify Schema Update | |
on: | |
workflow_call: | |
workflow_run: | |
workflows: ["Verify Database"] | |
types: | |
- completed | |
defaults: | |
run: | |
working-directory: ./server | |
env: | |
DATABASE_URL: postgresql://postgres:password@localhost:5433/f1_fantasy_league_db?schema=public | |
jobs: | |
verify: | |
runs-on: ubuntu-latest | |
permissions: | |
contents: write | |
steps: | |
- uses: actions/checkout@v3 | |
- name: execute flyway in docker 🐳 | |
run: docker compose up -d | |
- name: pnpm-setup | |
uses: pnpm/action-setup@v2 | |
- name: Server Install | |
run: pnpm i | |
- name: Prisma Pull | |
run: npx prisma db pull | |
- name: Prisma Generate | |
run: npx prisma generate | |
- name: Check for modified snapshots / database schema | |
id: snapshot-check | |
run: echo ::set-output name=modified::$(if git status | grep "nothing to commit"; then echo "false"; else echo "true"; fi) | |
- name: Commit any updated snapshots / database schema changes | |
if: steps.snapshot-check.outputs.modified == 'true' | |
uses: stefanzweifel/git-auto-commit-action@v5 | |
with: | |
commit_message: Commit for snapshot update | |
- name: Spin Down Docker 🐳 | |
run: docker compose down |