Sequelize migrations action
An action for auto recognize new Sequelize files submitted in a pull request. The files will be sent to be analyzed and derive insights at Metis Data platform.
Please use standard Sequelize migrations files that generated by Sequelize cli and exports up/down functions from module.
Add the following step to your workflow:
- name: Analyze migrations
uses: metis-data/sequelize-migrations-[email protected]
with:
from: ${{ github.event.pull_request.base.sha }}
to: ${{ github.event.pull_request.head.sha }}
github_token: ${{ github.token }}
metis_api_key: <Your Api Key>
migrations_dir: <path/to/migrations/directory>
For example, you can run it in a GitHub Actions workflow job:
on:
pull_request:
types: [opened, reopened, edited, synchronize, ready_for_review]
jobs:
migrations:
name: Analyze new migrations
runs-on: ubuntu-latest
services:
postgres:
image: postgres
env:
POSTGRES_USER: postgres
POSTGRES_PASSWORD: postgres
POSTGRES_DB: postgres
ports:
- 5432:5432
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
steps:
- name: Checkout
uses: actions/[email protected]
with:
fetch-depth: 0
- name: Compare migrations
uses: metis-data/sql-migrations-[email protected]
with:
from: ${{ github.event.pull_request.base.sha }}
to: ${{ github.event.pull_request.head.sha }}
github_token: ${{ github.token }}
metis_api_key: <Your Api Key>
migrations_dir: migrations
Note: For this action to work, you have to set up postgres service that is used to produce the SQL queries.
from
: Base sha to be comparedto
: Branch sha to be compared withgithub_token
: Auto generated workflow GitHub tokenmigrations_dir
: Path in your project to Sequelize migrations directory
Last modified 2mo ago