diff --git a/.github/actions/collect-changes/action.yaml b/.github/actions/collect-changes/action.yaml index c32b94ed..3947f34a 100644 --- a/.github/actions/collect-changes/action.yaml +++ b/.github/actions/collect-changes/action.yaml @@ -3,8 +3,11 @@ description: "Collects and stores changed files/charts" outputs: changesDetected: - description: "Whether or not changes to charts have been detected" + description: "Whether or not changes to files have been detected" value: ${{ steps.filter.outputs.addedOrModified }} + chartChangesDetected: + description: "Whether or not changes to charts have been detected" + value: ${{ steps.filter.outputs.chartsAddedOrModified }} addedOrModifiedFiles: description: "A list of the files changed" value: ${{ steps.filter.outputs.addedOrModified_files }} @@ -26,6 +29,8 @@ runs: filters: | addedOrModified: - added|modified: '**' + chartsAddedOrModified: + - added|modified: 'charts/*/**' - name: Collect changed charts id: changed-charts diff --git a/.github/workflows/charts-lint.yaml b/.github/workflows/charts-lint.yaml index 98f91cce..7a43f67f 100644 --- a/.github/workflows/charts-lint.yaml +++ b/.github/workflows/charts-lint.yaml @@ -9,6 +9,9 @@ on: chartChangesDetected: required: true type: string + chartChanges: + required: true + type: string jobs: lint: @@ -34,20 +37,20 @@ jobs: - name: Set up chart-testing uses: helm/chart-testing-action@v2.2.1 - - name: Collect changes - id: list-changed - if: inputs.chartChangesDetected == 'true' - run: | - EXCLUDED=$(yq eval -o=json '.excluded-charts // []' .ci/ct/ct-lint.yaml) - CHARTS=$(ct list-changed --config .ci/ct/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: Collect changes + # id: list-changed + # if: inputs.chartChangesDetected == 'true' + # run: | + # EXCLUDED=$(yq eval -o=json '.excluded-charts // []' .ci/ct/ct-lint.yaml) + # CHARTS=$(ct list-changed --config .ci/ct/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' + if: inputs.chartChanges != '' run: ct lint --config .ci/ct/ct-lint.yaml diff --git a/.github/workflows/pr-validate.yaml b/.github/workflows/pr-validate.yaml index 4e4b449e..b5631d05 100644 --- a/.github/workflows/pr-validate.yaml +++ b/.github/workflows/pr-validate.yaml @@ -36,14 +36,15 @@ jobs: # isRenovatePR: ${{ needs.pr-metadata.outputs.isRenovatePR }} # modifiedCharts: ${{ needs.pr-metadata.outputs.addedOrModifiedCharts }} - # charts-lint: - # uses: bjw-s/helm-charts/.github/workflows/charts-lint.yaml@main - # needs: - # - pr-metadata - # - charts-changelog - # with: - # checkoutCommit: ${{ needs.charts-changelog.outputs.commitHash }} - # chartChangesDetected: ${{ needs.pr-metadata.outputs.addedOrModified }} + charts-lint: + uses: bjw-s/helm-charts/.github/workflows/charts-lint.yaml@main + needs: + - pr-metadata + # - charts-changelog + with: + checkoutCommit: ${GITHUB_SHA} + chartChangesDetected: ${{ needs.pr-metadata.outputs.chartChangesDetected }} + chartChanges: ${{ needs.pr-metadata.outputs.addedOrModifiedCharts }} # charts-test: # uses: bjw-s/helm-charts/.github/workflows/charts-test.yaml@main