name: Linting
permissions: {}
on:
  push:
    branches:
      - "*"
  pull_request:
    branches:
      - "*"
concurrency:
  group: ${{ github.workflow }}-${{ github.ref }}
  cancel-in-progress: true
jobs:
  manifests:
    name: diff
    runs-on: ubuntu-24.04
    steps:
      - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7
        with:
          fetch-depth: 0
      - uses: actions/setup-go@b7ad1dad31e06c5925ef5d2fc7ad053ef454303e # v7.0.0
        with:
          go-version-file: 'go.mod'
      - name: Generate manifests
        run: |
          make generate
          make manifests
          if [[ $(git diff --stat) != '' ]]; then
            echo -e '\033[0;31mManifests outdated! (Run make manifests locally and commit)\033[0m ❌'
            git diff --color
            exit 1
          else
            echo -e '\033[0;32mDocumentation up to date\033[0m ✔'
          fi
  yamllint:
    name: yamllint
    runs-on: ubuntu-24.04
    steps:
      - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7
      - name: Install yamllint
        run: pip install yamllint
      - name: Lint YAML files
        run: yamllint -c=.github/configs/lintconf.yaml .
  golangci:
    name: lint
    runs-on: ubuntu-24.04
    steps:
      - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7
      - uses: actions/setup-go@b7ad1dad31e06c5925ef5d2fc7ad053ef454303e # v7.0.0
        with:
          go-version-file: 'go.mod'
      - name: Run golangci-lint
        run: make golint
