This commit is contained in:
Bᴇʀɴᴅ Sᴄʜᴏʀɢᴇʀs 2022-07-27 10:44:31 +02:00
parent 0802eed93e
commit 6fd154cb99
No known key found for this signature in database
GPG key ID: BC5E2BD907F9A8EC
3 changed files with 31 additions and 22 deletions

View file

@ -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

View file

@ -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

View file

@ -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-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 }}
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