Skip to content

Commit

Permalink
import
Browse files Browse the repository at this point in the history
  • Loading branch information
MichaelSp committed Jun 1, 2024
0 parents commit 31df5da
Show file tree
Hide file tree
Showing 35 changed files with 1,602 additions and 0 deletions.
45 changes: 45 additions & 0 deletions .github/actions/collect-changes/action.yaml
Original file line number Diff line number Diff line change
@@ -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@v3
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[*]}"
48 changes: 48 additions & 0 deletions .github/actions/label-from-status/action.yaml
Original file line number Diff line number Diff line change
@@ -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/[email protected]
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/[email protected]
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/[email protected]
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"
111 changes: 111 additions & 0 deletions .github/labels.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,111 @@
---
# CI Status
- name: "precommit:ok"
color: "0E8A16"
description: >-
CI status: pre-commit validation successful
- name: "precommit:failed"
color: "D93F0B"
description: >-
CI status: pre-commit validation failed
- name: "changelog:ok"
color: "0E8A16"
description: >-
CI status: changelog validation successful
- name: "changelog:failed"
color: "D93F0B"
description: >-
CI status: changelog validation failed
- name: "lint:ok"
color: "0E8A16"
description: >-
CI status: linting successful
- name: "lint:failed"
color: "D93F0B"
description: >-
CI status: linting failed
- name: "install:ok"
color: "0E8A16"
description: >-
CI status: install successful
- name: "install:failed"
color: "D93F0B"
description: >-
CI status: install failed
# Semantic Type
- name: type/patch
color: "FFEC19"
- name: type/minor
color: "FF9800"
- name: type/major
color: "F6412D"

# Renovate
- name: renovate/container
color: "ffc300"
- name: renovate/helm
color: "ffc300"

# Size
- name: size/XS
color: "009900"
description: >-
Categorises a PR that changes 0-9 lines, ignoring generated files.
- name: size/S
color: "77bb00"
description: >-
Categorises a PR that changes 10-29 lines, ignoring generated files.
- name: size/M
color: "eebb00"
description: >-
Categorises a PR that changes 30-99 lines, ignoring generated files.
- name: size/L
color: "ee9900"
description: >-
Categorises a PR that changes 100-499 lines, ignoring generated files.
- name: size/XL
color: "ee5500"
description: >-
Categorises a PR that changes 500-999 lines, ignoring generated files.
- name: size/XXL
color: "ee0000"
description: >-
Categorises a PR that changes 1000+ lines, ignoring generated files.
# Issue categories
- name: documentation
color: "0075ca"
- name: bug
color: "B60205"
- name: enhancement
color: "a2eeef"
- name: "help wanted"
color: "008672"
- name: wontfix
color: "ffffff"
- name: "support"
color: ffffff
- name: "incomplete-template"
color: ffffff

- name: "new-chart"
color: "C2E0C6"
description: >-
Categorises a PR or issue that references a new Helm chart.
- name: do-not-merge
color: "ee0701"
description: >-
Categorises a PR that should not be merged in the current state.
- name: "incomplete-docs"
color: B72175
description: >-
Categorises a PR for which the documentation has not been updated completely.
- name: keepalive
color: "4D28C4"
description: >-
Categorises a PR or issue that should not be marked as stale.
- name: stale
color: "D4C5F9"
description: >-
Categorises a PR or issue that has not been active for a specified time.
4 changes: 4 additions & 0 deletions .github/renovate.json5
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"$schema": "https://docs.renovatebot.com/renovate-schema.json",
"extends": ["github>MichaelSp/MichaelSp//.github/renovate.json5"],
}
49 changes: 49 additions & 0 deletions .github/scripts/check-releasenotes.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
#!/usr/bin/env bash

set -e

# Check if release notes have been changed
# Usage ./check-releasenotes.sh path

# require yq
command -v yq >/dev/null 2>&1 || {
printf >&2 "%s\n" "yq (https://github.com/mikefarah/yq) is not installed. Aborting."
exit 1
}

# Absolute path of repository
repository=$(git rev-parse --show-toplevel)

# Allow for a specific chart to be passed in as a argument
if [ $# -ge 1 ] && [ -n "$1" ]; then
root="$1"
chart_file="${1}/Chart.yaml"
if [ ! -f "$chart_file" ]; then
printf >&2 "File %s\n does not exist.\n" "${chart_file}"
exit 1
fi

cd $root

if [ -z "$DEFAULT_BRANCH" ]; then
DEFAULT_BRANCH=$(git remote show origin | awk '/HEAD branch/ {print $NF}')
fi

CURRENT=$(cat Chart.yaml | yq e '.annotations."artifacthub.io/changes"' -P -)

if [ "$CURRENT" == "" ] || [ "$CURRENT" == "null" ]; then
printf >&2 "Changelog annotation has not been set in %s!\n" "$chart_file"
exit 1
fi

DEFAULT_BRANCH=$(git remote show origin | awk '/HEAD branch/ {print $NF}')
ORIGINAL=$(git show origin/$DEFAULT_BRANCH:./Chart.yaml | yq e '.annotations."artifacthub.io/changes"' -P -)

if [ "$CURRENT" == "$ORIGINAL" ]; then
printf >&2 "Changelog annotation has not been updated in %s!\n" "$chart_file"
exit 1
fi
else
printf >&2 "%s\n" "No chart folder has been specified."
exit 1
fi
Loading

0 comments on commit 31df5da

Please sign in to comment.