mirror of
https://github.com/k8s-at-home/charts.git
synced 2025-01-23 15:39:02 +00:00
ci: Update linting script
Signed-off-by: Bᴇʀɴᴅ Sᴄʜᴏʀɢᴇʀs <me@bjw-s.dev>
This commit is contained in:
parent
8b37db4b7c
commit
8f5d80ab5e
1
.github/workflows/charts-validate.yaml
vendored
1
.github/workflows/charts-validate.yaml
vendored
@ -246,6 +246,7 @@ jobs:
|
||||
# Summarize matrix https://github.community/t/status-check-for-a-matrix-jobs/127354/7
|
||||
lint_success:
|
||||
needs:
|
||||
- changes-lint
|
||||
- lint
|
||||
if: |
|
||||
always() &&
|
||||
|
@ -1,13 +1,13 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
set -eu
|
||||
set -e
|
||||
|
||||
# Check if release notes have been changed
|
||||
# Usage ./check-releasenotes.sh path
|
||||
|
||||
# require yq
|
||||
command -v yq >/dev/null 2>&1 || {
|
||||
echo >&2 "yq (https://github.com/mikefarah/yq) is not installed. Aborting."
|
||||
printf >&2 "%s\n" "yq (https://github.com/mikefarah/yq) is not installed. Aborting."
|
||||
exit 1
|
||||
}
|
||||
|
||||
@ -19,17 +19,21 @@ if [ $# -ge 1 ] && [ -n "$1" ]; then
|
||||
root="$1"
|
||||
chart_file="${1}/Chart.yaml"
|
||||
if [ ! -f "$chart_file" ]; then
|
||||
echo "File ${chart_file} does not exist."
|
||||
printf >&2 "File %s\n does not exist.\n" "${chart_file}"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo "Validating release notes for $root"
|
||||
|
||||
cd $root
|
||||
|
||||
if [ -z "$DEFAULT_BRANCH" ]; then
|
||||
DEFAULT_BRANCH=$(git remote show origin | awk '/HEAD branch/ {print $NF}')
|
||||
fi
|
||||
|
||||
printf "Checking changelog annotation for chart %s\n" "$root"
|
||||
CURRENT=$(cat Chart.yaml | yq e '.annotations."artifacthub.io/changes"' -P -)
|
||||
|
||||
if [ "$CURRENT" == "" ] || [ "$CURRENT" == "null" ]; then
|
||||
echo >&2 "Release notes have not been set for this chart!"
|
||||
printf >&2 "%s\n" "Changelog annotation has not been set for this chart!"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
@ -37,10 +41,16 @@ if [ $# -ge 1 ] && [ -n "$1" ]; then
|
||||
ORIGINAL=$(git show origin/$DEFAULT_BRANCH:./Chart.yaml | yq e '.annotations."artifacthub.io/changes"' -P -)
|
||||
|
||||
if [ "$CURRENT" == "$ORIGINAL" ]; then
|
||||
echo >&2 "Release notes have not been updated!"
|
||||
printf >&2 "%s\n" "Changelog annotation has not been updated!"
|
||||
# exit 1
|
||||
fi
|
||||
|
||||
printf "Checking README.md for chart %s\n" "$root"
|
||||
if diff README.md <(git show origin/$DEFAULT_BRANCH:./README.md) >/dev/null; then
|
||||
printf >&2 "%s\n" "README.md has not been updated!"
|
||||
exit 1
|
||||
fi
|
||||
else
|
||||
echo >&2 "No chart folder has been specified."
|
||||
printf >&2 "%s\n" "No chart folder has been specified."
|
||||
exit 1
|
||||
fi
|
||||
|
Loading…
Reference in New Issue
Block a user