cal-itp / benefits

Transit benefits enrollment, minus the paperwork.
https://docs.calitp.org/benefits
GNU Affero General Public License v3.0
25 stars 9 forks source link

Add a PR check to ensure migrations are up to date #2092

Closed thekaveman closed 1 month ago

thekaveman commented 2 months ago

Sometimes we make model changes and forget to generate a new migration, e.g. with the case of #2078 and the follow-up #2086.

Let's create a PR check that runs the bin/makemigrations.sh script and errors if there are pending migrations.

When a migration is needed, the output looks like:

$ bin/makemigrations.sh
Migrations for 'core':
  benefits/core/migrations/NNNN_changes.py
    - [description of changes]

When there are no pending migrations, the output looks like:

$ bin/makemigrations.sh
No changes detected

Acceptance Criteria

angela-tran commented 1 month ago

The workflow is added as a required check to merge PRs

Need to configure this once it is available in Settings

thekaveman commented 1 month ago

I added this as a required check for dev, test, and prod.

thekaveman commented 1 month ago

I forgot, if we have a required check that only runs sometimes (e.g. because of a path filter on the PR files) then that check will block some PRs.

I think to simplify we can just remove the path filter in the workflow. This check shouldn't take very long comparatively.