This commit is contained in:
Bᴇʀɴᴅ Sᴄʜᴏʀɢᴇʀs 2022-07-26 21:56:16 +02:00
parent ad184ab678
commit f5a67d0150
No known key found for this signature in database
GPG key ID: BC5E2BD907F9A8EC
10 changed files with 387 additions and 0 deletions

View file

@ -0,0 +1,45 @@
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
shell: bash
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[*]}"

View file

@ -0,0 +1,48 @@
name: "Set issue labels based on status"
description: "Sets / removes issue labels based on CI job status"
inputs:
token:
required: true
description: "The Github API token to use"
issue-number:
required: true
description: "The issue to label"
prefix:
required: true
description: "The label prefix (e.g. lint, install)"
job-status:
required: true
description: "The status of the CI job"
remove-on-skipped:
required: false
default: "false"
description: "Remove the label if the job was skipped"
runs:
using: "composite"
steps:
- name: Label success
uses: andymckay/labeler@1.0.4
if: ${{ inputs.job-status == 'success' }}
with:
repo-token: ${{ inputs.token }}
issue-number: ${{ inputs.issue-number }}
add-labels: "${{ inputs.prefix }}:ok"
remove-labels: "${{ inputs.prefix }}:failed"
- name: Label failure
uses: andymckay/labeler@1.0.4
if: ${{ inputs.job-status == 'failure' }}
with:
repo-token: ${{ inputs.token }}
issue-number: ${{ inputs.issue-number }}
add-labels: "${{ inputs.prefix }}:failed"
remove-labels: "${{ inputs.prefix }}:ok"
- name: Remove label
uses: andymckay/labeler@1.0.4
if: ${{ (inputs.job-status == 'skipped') && (inputs.remove-on-skipped == 'true') }}
with:
repo-token: ${{ inputs.token }}
issue-number: ${{ inputs.issue-number }}
remove-labels: "${{ inputs.prefix }}:ok, ${{ inputs.prefix }}:failed"