mirror of
https://github.com/bjw-s-labs/helm-charts.git
synced 2025-07-03 08:37:03 +02:00
64 lines
2 KiB
YAML
64 lines
2 KiB
YAML
name: "Collect changes"
|
|
description: "Collects and stores changed files/charts"
|
|
|
|
inputs:
|
|
token:
|
|
required: true
|
|
description: "The Github API token to use"
|
|
working-directory:
|
|
required: false
|
|
description: "The working dir to use when checking for changes"
|
|
default: "."
|
|
|
|
outputs:
|
|
changesDetected:
|
|
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 that changed"
|
|
value: ${{ steps.filter.outputs.addedOrModified_files }}
|
|
addedOrModifiedChartFiles:
|
|
description: "A list of the chart files that changed"
|
|
value: ${{ steps.filter.outputs.chartsAddedOrModified_files }}
|
|
addedOrModifiedCharts:
|
|
description: "A list of the charts changed"
|
|
value: ${{ steps.changed-charts.outputs.addedOrModifiedCharts }}
|
|
|
|
runs:
|
|
using: "composite"
|
|
steps:
|
|
- name: Collect changed files
|
|
uses: dorny/paths-filter@v2
|
|
id: filter
|
|
with:
|
|
token: ${{ inputs.token }}
|
|
working-directory: ${{ inputs.working-directory }}
|
|
list-files: shell
|
|
filters: |
|
|
addedOrModified:
|
|
- added|modified: '**'
|
|
chartsAddedOrModified:
|
|
- added|modified: 'charts/*/**'
|
|
|
|
- name: Collect changed charts
|
|
id: changed-charts
|
|
shell: bash
|
|
run: |
|
|
CHARTS=()
|
|
PATHS=(${{ steps.filter.outputs.chartsAddedOrModified_files }})
|
|
|
|
# Get only the chart paths
|
|
for CHARTPATH in "${PATHS[@]}"
|
|
do
|
|
IFS='/' read -r -a path_parts <<< "${CHARTPATH}"
|
|
CHARTS+=("${path_parts[1]}/${path_parts[2]}")
|
|
done
|
|
|
|
# Remove duplicates
|
|
CHARTS=( `printf "%s\n" "${CHARTS[@]}" | sort -u` )
|
|
|
|
# Set output to changed charts
|
|
printf "::set-output name=addedOrModifiedCharts::%s\n" "${CHARTS[*]}"
|