Skip to content

Commit

Permalink
Add github workflow for analytics migrations
Browse files Browse the repository at this point in the history
  • Loading branch information
jjnesbitt committed Aug 31, 2023
1 parent a84f41f commit f827986
Showing 1 changed file with 43 additions and 0 deletions.
43 changes: 43 additions & 0 deletions .github/workflows/analytics_migrations.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
name: Check Analytics Migrations

on:
pull_request:
paths:
# - "analytics/analytics/**"
- "analytics/analytics/*"

jobs:
# This prevents unnecessary runs, as the pull_request.paths event qualifier doesn't seem to correctly dispatch synchronize events
# check-modified-paths:
# if: ${{ github.event_name == 'pull_request' }}
# runs-on: ubuntu-latest
# outputs:
# result: ${{ steps.main.outputs.result }}
# steps:
# - name: Checkout
# uses: actions/checkout@v3
# with:
# fetch-depth: 0

# - name: Check for modified paths
# id: main
# run: "! git diff --quiet HEAD ${{ github.event.pull_request.base.sha }} -- analytics/analytics/; echo result=$? >> $GITHUB_OUTPUT"

check-migrations:
# needs: check-modified-paths
# if: ${{ needs.check-modified-paths.outputs.result == 0 }}
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3

- name: Install requirements
run: pip install -r ./analytics/requirements.txt

- name: Provide default env vars for django
run: cat ./analytics/dev/.env.docker-compose >> $GITHUB_ENV

# This runs on pull requests and blocks until any necessary migrations have been created
# *Note*: This will display a warning about not being able to connect to a database. This can be ignored.
- name: Check for Migrations
run: ./analytics/manage.py makemigrations --check --noinput

0 comments on commit f827986

Please sign in to comment.