pytest-mrt-action

June 10, 2026 · View on GitHub

GitHub Actions action for pytest-mrt — runs mrt check on your migration files and posts results as a job summary.

Usage

- uses: actions/checkout@v4

- uses: actions/setup-python@v5
  with:
    python-version: "3.12"

- uses: croc100/pytest-mrt-action@v1
  with:
    migrations-dir: alembic/versions/

Results are posted to the GitHub Actions job summary automatically.

Inputs

InputDescriptionDefault
migrations-dirPath to the migrations directoryrequired
versionpytest-mrt version to installlatest
strictTreat warnings as errorsfalse
min-revisionSkip revisions at or older than this floor
sinceOnly check revisions newer than this (incremental CI)

Outputs

OutputDescription
errorsNumber of error-severity findings
warningsNumber of warning-severity findings
passedtrue if no errors (or no warnings when strict: true)

Examples

Fail on any error

- uses: croc100/pytest-mrt-action@v1
  with:
    migrations-dir: alembic/versions/

Fail on warnings too (strict mode)

- uses: croc100/pytest-mrt-action@v1
  with:
    migrations-dir: alembic/versions/
    strict: "true"

Only check new migrations (incremental)

- uses: croc100/pytest-mrt-action@v1
  with:
    migrations-dir: alembic/versions/
    since: ${{ github.event.pull_request.base.sha }}

Django

- uses: croc100/pytest-mrt-action@v1
  with:
    migrations-dir: myapp/migrations/

Pin a specific version

- uses: croc100/pytest-mrt-action@v1
  with:
    migrations-dir: alembic/versions/
    version: "1.4.0"

How it works

  1. Installs pytest-mrt
  2. Runs mrt check <migrations-dir> --format json
  3. Parses the JSON output and writes a markdown table to $GITHUB_STEP_SUMMARY
  4. Exits with the same code as mrt check — non-zero on errors