name: Lint

on:
  push:
    branches: [main] # pushes TO main
  pull_request:
    branches: [main] # pull requests AGAINST main

# cancel CI runs when a new commit is pushed to any branch except main
concurrency:
  group: "lint-${{ github.ref }}"
  cancel-in-progress: ${{ github.ref != 'refs/heads/main' }}

jobs:
  golangci:
    name: Lint
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v2
      - uses: actions/setup-go@v2
        with:
          go-version: '1.20'
      - uses: golangci/golangci-lint-action@v3.4.0
        with:
          version: v1.52.2