name: Helm CI
on:
  pull_request:
    paths:
      - "charts/**"

permissions: read-all

jobs:
  lint-and-test:
    runs-on: ubuntu-20.04
    steps:
      - name: Checkout code
        uses: actions/checkout@v3
        with:
          fetch-depth: 0
      - name: Lint chart
        id: lint
        uses: helm/chart-testing-action@v2.2.1
        with:
          command: lint
          config: .ct.yaml
      - name: Create kind cluster
        uses: helm/kind-action@v1.2.0
        if: steps.lint.outputs.changed == 'true'
      - name: Install chart
        uses: helm/chart-testing-action@v2.2.1
        if: steps.lint.outputs.changed == 'true'
        with:
          command: install
          config: .ct.yaml
