diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 2687d026b..26b0ba89e 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -89,4 +89,34 @@ jobs: - name: Test Policy run: go run ./cmd/cli/kubectl-kyverno test ../policies - working-directory: kyverno \ No newline at end of file + working-directory: kyverno + + lint: + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@3df4ab11eba7bda6032a0b82a6bb43b11571feac # v4.0.0 + with: + path: policies + - name: Clone Kyverno + uses: actions/checkout@3df4ab11eba7bda6032a0b82a6bb43b11571feac # v4.0.0 + with: + repository: kyverno/kyverno + path: kyverno + # The target branch of a pull request or the branch/tag of a push + ref: ${{ github.base_ref || github.ref_name }} + - name: Set up Go + uses: actions/setup-go@93397bea11091df50f3d7e59dc26a7711a8bcfbe # v4.1.0 + with: + go-version: "1.20" + - name: Lint policies + run: | + set -e + KYVERNO_EXPERIMENTAL=true go run ./cmd/cli/kubectl-kyverno fix test . --save + working-directory: kyverno + - name: Check diff + run: | + set -e + git --no-pager diff . + git diff --quiet --exit-code . + working-directory: policies \ No newline at end of file