Merge pull request #14 from kilnfi/renovate/asdf-vm-actions-3.x #46
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Lint and Test Charts | |
on: | |
push: | |
branches: | |
- main | |
pull_request: | |
branches: | |
- main | |
jobs: | |
lint-test: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: Get base_sha | |
run: | | |
set -x | |
# "Set base sha..." | |
if [[ -n "${{ inputs.base_sha }}" ]]; then | |
echo "base_sha=${{ inputs.base_sha }}" >> $GITHUB_OUTPUT | |
elif [[ -n "${{ github.event.pull_request.base.sha }}" ]] && [[ "${{ github.event.pull_request.base.sha }}" != "0000000000000000000000000000000000000000" ]]; then | |
echo "base_sha=${{ github.event.pull_request.base.sha }}" >> $GITHUB_OUTPUT | |
elif [[ -n "${{ github.event.before }}" ]] && [[ "${{ github.event.before }}" != "0000000000000000000000000000000000000000" ]]; then | |
echo "base_sha=${{ github.event.before }}" >> $GITHUB_OUTPUT | |
fi | |
id: base-sha | |
- name: 'asdf:install' | |
uses: asdf-vm/actions/[email protected] | |
- uses: actions/setup-python@v4 | |
with: | |
python-version: 3.7 | |
- name: Set up chart-testing | |
uses: helm/[email protected] | |
- name: Run chart-testing (list-changed) | |
id: list-changed | |
run: | | |
set -euo pipefail | |
set -x | |
echo "changed=$( | |
ct list-changed --since "${BASE_SHA}" --target-branch main --chart-dirs charts \ | |
| awk -v d="," '{gsub(/charts\//, ""); s=(NR==1?s:s d) "\"" $0 "\""}END{print "["s"]"}' | |
)" >> $GITHUB_OUTPUT | |
env: | |
BASE_SHA: ${{ steps.base-sha.outputs.base_sha }} | |
- name: Run chart-testing (lint) | |
if: github.ref != 'refs/heads/main' | |
run: ct lint --since "${BASE_SHA}" --target-branch main --chart-dirs charts | |
env: | |
BASE_SHA: ${{ steps.base-sha.outputs.base_sha }} | |
- name: Check charts documentation | |
uses: pre-commit/[email protected] | |
with: | |
extra_args: --show-diff-on-failure --all-files | |
outputs: | |
changed: ${{ steps.list-changed.outputs.changed }} | |