Skip to content

Squawk action

Actions
Lint Postgres migrations with Squawk
v2.0.0
Latest
Star (8)

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@v4
      - uses: sbdchd/squawk-action@v2
        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@v4
        with:
          fetch-depth: 0
      - name: Find modified migrations
        run: |
          modified_migrations=$(git diff --diff-filter=d --name-only origin/$GITHUB_BASE_REF...origin/$GITHUB_HEAD_REF 'migrations/*.sql')
          echo "$modified_migrations"
          echo "file_names=$modified_migrations" >> $GITHUB_OUTPUT
        id: modified-migrations
      - uses: sbdchd/squawk-action@v2
        with:
          files: ${{ steps.modified-migrations.outputs.file_names }}

Tip

See action.yml for more action inputs.

example report

Example Squawk PR Comment

development

releasing a new version

  1. Release a new version (e.g. v5.2.1)
  2. Update major version tag to point to commit.
    git tag v5
    git push --tags

Squawk action is not certified by GitHub. It is provided by a third-party and is governed by separate terms of service, privacy policy, and support documentation.

About

Lint Postgres migrations with Squawk
v2.0.0
Latest

Squawk action is not certified by GitHub. It is provided by a third-party and is governed by separate terms of service, privacy policy, and support documentation.