charts/.github/workflows/charts-lint.yaml

55 lines
1.5 KiB
YAML
Raw Normal View History

name: "Charts: Lint"
on:
workflow_call:
inputs:
checkoutCommit:
required: true
type: string
2022-03-29 08:45:22 +00:00
chartChangesDetected:
required: true
type: string
jobs:
lint:
name: Lint charts
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
with:
fetch-depth: 0
ref: ${{ inputs.checkoutCommit }}
2022-02-05 18:57:55 +00:00
- name: Install Kubernetes tools
uses: yokawasa/action-setup-kube-tools@v0.8.2
with:
2022-02-05 18:57:55 +00:00
setup-tools: |
helmv3
2022-02-05 19:04:57 +00:00
helm: "3.8.0"
- uses: actions/setup-python@v4
with:
2022-02-05 19:04:57 +00:00
python-version: "3.10"
- name: Set up chart-testing
uses: helm/chart-testing-action@v2.3.0
- name: Collect changes
id: list-changed
2022-03-29 08:45:22 +00:00
if: inputs.chartChangesDetected == 'true'
run: |
EXCLUDED=$(yq eval -o=json '.excluded-charts // []' .github/ct-lint.yaml)
CHARTS=$(ct list-changed --config .github/ct-lint.yaml)
CHARTS_JSON=$(echo "${CHARTS}" | jq -R -s -c 'split("\n")[:-1]')
OUTPUT_JSON=$(echo "{\"excluded\": ${EXCLUDED}, \"all\": ${CHARTS_JSON}}" | jq -c '.all-.excluded')
echo ::set-output name=charts::${OUTPUT_JSON}
if [[ $(echo ${OUTPUT_JSON} | jq -c '. | length') -gt 0 ]]; then
echo "::set-output name=detected::true"
fi
- name: Run chart-testing (lint)
id: lint
if: steps.list-changed.outputs.detected == 'true'
run: ct lint --config .github/ct-lint.yaml