mirror of
https://github.com/k8s-at-home/charts.git
synced 2025-01-23 23:49:12 +00:00
ci: Use composite action to collect changes
Signed-off-by: Bᴇʀɴᴅ Sᴄʜᴏʀɢᴇʀs <me@bjw-s.dev>
This commit is contained in:
parent
34dea81127
commit
951d2c20f3
44
.github/actions/collect-changes/action.yaml
vendored
Normal file
44
.github/actions/collect-changes/action.yaml
vendored
Normal file
@ -0,0 +1,44 @@
|
|||||||
|
name: "Collect changes"
|
||||||
|
description: "Collects and stores changed files/charts"
|
||||||
|
|
||||||
|
outputs:
|
||||||
|
changesDetected:
|
||||||
|
description: "Whether or not changes to charts have been detected"
|
||||||
|
value: ${{ steps.filter.outputs.addedOrModified }}
|
||||||
|
addedOrModifiedFiles:
|
||||||
|
description: "A list of the files changed"
|
||||||
|
value: ${{ steps.filter.outputs.addedOrModified_files || "" }}
|
||||||
|
addedOrModifiedCharts:
|
||||||
|
description: "A list of the charts changed"
|
||||||
|
value: ${{ steps.filter-charts.outputs.addedOrModified || "" }}
|
||||||
|
|
||||||
|
runs:
|
||||||
|
using: "composite"
|
||||||
|
steps:
|
||||||
|
- name: Collect changed files
|
||||||
|
uses: dorny/paths-filter@v2
|
||||||
|
id: filter
|
||||||
|
with:
|
||||||
|
list-files: shell
|
||||||
|
filters: |
|
||||||
|
addedOrModified:
|
||||||
|
- added|modified: 'charts/**'
|
||||||
|
|
||||||
|
- name: Collect changed charts
|
||||||
|
if: |
|
||||||
|
steps.filter.outputs.addedOrModified == 'true'
|
||||||
|
id: filter-charts
|
||||||
|
run: |
|
||||||
|
CHARTS=()
|
||||||
|
PATHS=(${{ steps.filter.outputs.addedOrModified_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=addedOrModified::%s\n" "${CHARTS[*]}"
|
34
.github/workflows/charts-release.yaml
vendored
34
.github/workflows/charts-release.yaml
vendored
@ -42,39 +42,15 @@ jobs:
|
|||||||
wget -O /tmp/helm-docs.deb https://github.com/k8s-at-home/helm-docs/releases/download/v0.1.1/helm-docs_0.1.1_Linux_x86_64.deb
|
wget -O /tmp/helm-docs.deb https://github.com/k8s-at-home/helm-docs/releases/download/v0.1.1/helm-docs_0.1.1_Linux_x86_64.deb
|
||||||
sudo dpkg -i /tmp/helm-docs.deb
|
sudo dpkg -i /tmp/helm-docs.deb
|
||||||
|
|
||||||
- name: Collect changed files
|
- name: Collect changes
|
||||||
uses: dorny/paths-filter@v2
|
id: collect-changes
|
||||||
id: filter
|
uses: ./.github/actions/collect-changes
|
||||||
with:
|
|
||||||
list-files: shell
|
|
||||||
filters: |
|
|
||||||
addedOrModified:
|
|
||||||
- added|modified: 'charts/**'
|
|
||||||
|
|
||||||
- name: Collect changed charts
|
|
||||||
if: |
|
|
||||||
steps.filter.outputs.addedOrModified == 'true'
|
|
||||||
id: filter-charts
|
|
||||||
run: |
|
|
||||||
CHARTS=()
|
|
||||||
PATHS=(${{ steps.filter.outputs.addedOrModified_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=addedOrModified::%s\n" "${CHARTS[*]}"
|
|
||||||
|
|
||||||
- name: Generate README for changed charts in Renovate PR's
|
- name: Generate README for changed charts in Renovate PR's
|
||||||
if: |
|
if: |
|
||||||
steps.filter.outputs.addedOrModified == 'true'
|
steps.collect-changes.outputs.addedOrModified == 'true'
|
||||||
run: |
|
run: |
|
||||||
CHARTS=(${{ steps.filter-charts.outputs.addedOrModified }})
|
CHARTS=(${{ steps.collect-changes.outputs.addedOrModifiedCharts }})
|
||||||
for i in "${CHARTS[@]}"
|
for i in "${CHARTS[@]}"
|
||||||
do
|
do
|
||||||
IFS='/' read -r -a chart_parts <<< "$i"
|
IFS='/' read -r -a chart_parts <<< "$i"
|
||||||
|
36
.github/workflows/pr-metadata.yaml
vendored
36
.github/workflows/pr-metadata.yaml
vendored
@ -47,37 +47,13 @@ jobs:
|
|||||||
name: Collect PR changes
|
name: Collect PR changes
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
outputs:
|
outputs:
|
||||||
addedOrModified: ${{ steps.filter.outputs.addedOrModified }}
|
addedOrModified: ${{ steps.collect-changes.outputs.addedOrModified }}
|
||||||
addedOrModifiedFiles: ${{ steps.filter.outputs.addedOrModified_files }}
|
addedOrModifiedFiles: ${{ steps.collect-changes.outputs.addedOrModifiedFiles }}
|
||||||
addedOrModifiedCharts: ${{ steps.filter-charts.outputs.addedOrModified }}
|
addedOrModifiedCharts: ${{ steps.collect-changes.outputs.addedOrModifiedCharts }}
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout
|
- name: Checkout
|
||||||
uses: actions/checkout@v2
|
uses: actions/checkout@v2
|
||||||
|
|
||||||
- name: Collect changed files
|
- name: Collect changes
|
||||||
uses: dorny/paths-filter@v2
|
id: collect-changes
|
||||||
id: filter
|
uses: ./.github/actions/collect-changes
|
||||||
with:
|
|
||||||
list-files: shell
|
|
||||||
filters: |
|
|
||||||
addedOrModified:
|
|
||||||
- added|modified: 'charts/**'
|
|
||||||
|
|
||||||
- name: Collect changed charts
|
|
||||||
if: |
|
|
||||||
steps.filter.outputs.addedOrModified == 'true'
|
|
||||||
id: filter-charts
|
|
||||||
run: |
|
|
||||||
CHARTS=()
|
|
||||||
PATHS=(${{ steps.filter.outputs.addedOrModified_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=addedOrModified::%s\n" "${CHARTS[*]}"
|
|
||||||
|
Loading…
Reference in New Issue
Block a user