Skip to content

[bitnami/chainloop] Release 1.0.1 #3533

[bitnami/chainloop] Release 1.0.1

[bitnami/chainloop] Release 1.0.1 #3533

# Copyright Broadcom, Inc. All Rights Reserved.
# SPDX-License-Identifier: APACHE-2.0
name: '[CI/CD] Values ASCII validator'
on:
pull_request:
branches:
- main
paths:
- '**/values.yaml'
# Remove all permissions by default
permissions: {}
jobs:
values-ascii:
runs-on: ubuntu-latest
permissions:
contents: read
steps:
- name: Checkout project
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332
- name: Values ASCII validator
env:
DIFF_URL: "${{github.event.pull_request.diff_url}}"
TEMP_FILE: "${{runner.temp}}/pr-${{github.event.number}}.diff"
TEMP_OUTPUT: "${{runner.temp}}/output"
run: |
# This request doesn't consume API calls.
curl -Lkso $TEMP_FILE $DIFF_URL
files_changed="$(sed -nr 's/[\-\+]{3} [ab]\/(.*)/\1/p' $TEMP_FILE | sort | uniq)"
values_files="$(echo "$files_changed" | grep -o ".*values\.yaml$" | sort | uniq || true)"
# Create an empty file, useful when the PR changes ignored files
touch "${TEMP_OUTPUT}"
grep -nHP "[\x80-\xFF]" "${values_files[@]}" | sort -u > ${TEMP_OUTPUT} || true
while read -r line; do
# line format:
# file:row:message
# Split by ':'
readarray -d : -t strarr < <(printf '%s' "$line")
if [[ "${#strarr[@]}" -ge 3 ]]; then
echo "::warning file=${strarr[0]},line=${strarr[1]}:: Non ASCII character in '${strarr[@]:2}'"
else
echo "::warning:: Error processing: ${line}"
fi
done < "${TEMP_OUTPUT}"
if [[ -s ${TEMP_OUTPUT} ]]; then
echo "::error:: Please review warning messages"
exit 1
fi