Files
charts/.github/workflows/values-ascii-check.yml
dependabot[bot] af5b69c5be ⬆️ Bump actions/checkout from 4.2.2 to 5.0.0 (#36098)
Bumps [actions/checkout](https://github.com/actions/checkout) from 4.2.2 to 5.0.0.
- [Release notes](https://github.com/actions/checkout/releases)
- [Changelog](https://github.com/actions/checkout/blob/main/CHANGELOG.md)
- [Commits](11bd71901b...08c6903cd8)

---
updated-dependencies:
- dependency-name: actions/checkout
  dependency-version: 5.0.0
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-08-19 18:03:36 +02:00

49 lines
1.8 KiB
YAML

# 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@08c6903cd8c0fde910a37f88322edcfb5dd907a8
- 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