Skip to content
You're viewing an older version of this GitHub Action. Do you want to see the latest version instead?
check-square

GitHub Action

Squawk action

v1.0.0

Squawk action

check-square

Squawk action

Lint Postgres migrations with Squawk

Installation

Copy and paste the following snippet into your .yml file.

              

- name: Squawk action

uses: sbdchd/[email protected]

Learn more about this action in sbdchd/squawk-action

Choose a version

squawk-action GitHub release (latest SemVer)

A GitHub Action for Squawk.

Lint Postgres migrations and report violations as a comment in a GitHub Pull Request (example PR).

For more information on Squawk, see the Squawk GitHub repository or website.

basic usage

Lint every .sql file in migrations/ on every pull request.

# .github/workflows/lint-migrations.yml
name: Lint Migrations

on: pull_request

jobs:
  lint_migrations:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v1
      - uses: sbdchd/squawk-action@v1
        with:
          pattern: "migrations/*.sql"
          version: "latest"

advanced usage

Only lint modified .sql files in the migrations/.

# .github/workflows/lint-migrations.yml
name: Lint Migrations

on: pull_request

jobs:
  lint_migrations:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v1
      - name: Find modified migrations
        run: |
          modified_migrations=$(git diff --name-only origin/$GITHUB_BASE_REF...origin/$GITHUB_HEAD_REF 'migrations/*.sql')
          echo "$modified_migrations"
          echo "::set-output name=file_names::$modified_migrations"
        id: modified-migrations
      - uses: sbdchd/squawk-action@v1
        with:
          pattern: ${{ steps.modified-migrations.outputs.file_names }}

example report

Example Squawk PR Comment