name: lint
on:
  push:
    branches:
      - main
  pull_request:
permissions:
  contents: read
jobs:
  lint:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v3
      - name: Build Docker image
        run: docker build -t pg-schema-diff-lint-runner -f ./build/Dockerfile.lint .
      - name: Run lint
        run: docker run pg-schema-diff-lint-runner
  # The "lint" job will lint go (and SQL). The "go_lint" job will also lint go but adds comments to the PR on the lines
  # containing the linting errors
  go_lint:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v3
      - uses: actions/setup-go@v5
        with:
          go-version: '1.20'
          cache: false
      - name: golangci-lint
        uses: golangci/golangci-lint-action@v3
        with:
          version: v1.56.2

