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
| Input | Description | Default |
|---|---|---|
migrations-dir | Path to the migrations directory | required |
version | pytest-mrt version to install | latest |
strict | Treat warnings as errors | false |
min-revision | Skip revisions at or older than this floor | — |
since | Only check revisions newer than this (incremental CI) | — |
Outputs
| Output | Description |
|---|---|
errors | Number of error-severity findings |
warnings | Number of warning-severity findings |
passed | true 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
- Installs pytest-mrt
- Runs
mrt check <migrations-dir> --format json - Parses the JSON output and writes a markdown table to
$GITHUB_STEP_SUMMARY - Exits with the same code as
mrt check— non-zero on errors