name: golangci-lint
on:
  push:
    tags:
      - v*
    branches:
      - main
  pull_request:
permissions:
  contents: read

jobs:
  golangci:
    permissions:
      contents: read  # for actions/checkout to fetch code
      pull-requests: read  # for golangci/golangci-lint-action to fetch pull requests
    name: lint
    runs-on: ubuntu-latest
    steps:
      - uses: actions/setup-go@f6164bd8c8acb4a71fb2791a8b6c4024ff038dab # v2
        with:
          go-version: ~1.18
      - uses: actions/checkout@b0e28b5ac45a892f91e7d036f8200cf5ed489415 # v3
      - name: golangci-lint
        uses: golangci/golangci-lint-action@b517f99ae23d86ecc4c0dec08dcf48d2336abc29 # v3
        with:
          skip-go-installation: true
          args: --timeout=5m
