name: golangci-lint
on:
  push:
    branches:
      - master
  pull_request:
    branches:
      - master
  schedule:
    # Trigger every day at 16:00 UTC
    - cron:  '0 16 * * *'
jobs:
  golangci-pr:
    if: github.ref != 'refs/heads/master'
    name: lint-pr-changes
    runs-on: ubuntu-latest
    steps:
      - uses: actions/setup-go@v2
      - uses: actions/checkout@v2
      - name: golangci-lint
        uses: golangci/golangci-lint-action@v2
        with:
          version: v1.46.2
          only-new-issues: true
  golangci-master:
    if: github.ref == 'refs/heads/master'
    name: lint-master-all
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v2
      - name: golangci-lint
        uses: golangci/golangci-lint-action@v2
        with:
          version: v1.46.2
          only-new-issues: true
          args: --issues-exit-code=0
