| Eric Ball | 60265fe | 2026-05-26 17:14:49 -0700 | [diff] [blame^] | 1 | --- |
| 2 | # SPDX-License-Identifier: Apache-2.0 |
| 3 | # SPDX-FileCopyrightText: 2026 The Linux Foundation |
| 4 | |
| 5 | name: Lint and Test Charts |
| 6 | description: "Lint and test Helm charts" |
| 7 | |
| 8 | inputs: |
| 9 | target-branch: |
| 10 | description: "Target branch to compare against for detecting changed charts" |
| 11 | required: true |
| 12 | |
| 13 | runs: |
| 14 | using: "composite" |
| 15 | steps: |
| 16 | - name: Checkout |
| 17 | uses: actions/checkout@v5 |
| 18 | with: |
| 19 | fetch-depth: 0 |
| 20 | |
| 21 | - name: Set up Helm |
| 22 | uses: azure/setup-helm@v4.3.1 |
| 23 | |
| 24 | - uses: actions/setup-python@v6.0.0 |
| 25 | with: |
| 26 | python-version: "3.x" |
| 27 | check-latest: true |
| 28 | |
| 29 | - name: Set up chart-testing |
| 30 | uses: helm/chart-testing-action@v2.8.0 |
| 31 | |
| 32 | - name: Run chart-testing (list-changed) |
| 33 | id: list-changed |
| 34 | shell: bash |
| 35 | run: | |
| 36 | changed=$(ct list-changed --target-branch ${{ inputs.target-branch }}) |
| 37 | if [[ -n "$changed" ]]; then |
| 38 | echo "changed=true" >> "$GITHUB_OUTPUT" |
| 39 | fi |
| 40 | |
| 41 | - name: Run chart-testing (lint) |
| 42 | if: steps.list-changed.outputs.changed == 'true' |
| 43 | shell: bash |
| 44 | run: ct lint --target-branch ${{ inputs.target-branch }} |
| 45 | |
| 46 | - name: Create kind cluster |
| 47 | if: steps.list-changed.outputs.changed == 'true' |
| 48 | uses: helm/kind-action@v1.12.0 |
| 49 | |
| 50 | - name: Run chart-testing (install) |
| 51 | if: steps.list-changed.outputs.changed == 'true' |
| 52 | shell: bash |
| 53 | run: ct install --target-branch ${{ inputs.target-branch }} |