Skip to content

Commit

Permalink
test colors
Browse files Browse the repository at this point in the history
  • Loading branch information
M. Fatih Cırıt committed Feb 20, 2024
1 parent 5dbf9b5 commit bf7ab00
Showing 1 changed file with 12 additions and 3 deletions.
15 changes: 12 additions & 3 deletions json-schema-check/action.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,14 @@ runs:
# Use a file to track failures
touch check_failures
# Ensure output supports color
export TERM=xterm-color
# ANSI color codes
RED='\033[0;31m'
GREEN='\033[0;32m'
NO_COLOR='\033[0m'
find . -path '*/schema/*.schema.json' -exec bash -c '
schemaFile="${1#./}" # Normalize schema file path to remove leading ./
Expand All @@ -28,18 +36,19 @@ runs:
configFiles=("${configDir}/${baseName}"*.param.yaml) # Pattern match for config files
for configFile in "${configFiles[@]}"; do
echo -n "🔍 Validating: $configFile 🆚 $schemaFile ️ "
echo -ne "🔍 Validating: $configFile 🆚 $schemaFile ️ "
if ! check-jsonschema --schemafile "$schemaFile" "$configFile"; then
# If validation fails, print failure message and record the failure
echo "❌ Failed"
echo -e "${RED}❌ Failed${NO_COLOR}"
echo "1" > check_failures
fi
done
' bash {} \;
if [ "$(cat check_failures)" = "1" ]; then
echo "❗ Validation failed for one or more files."
echo -e "${RED}❗ Validation failed for one or more files.${NO_COLOR}"
rm check_failures # Clean up
exit 1
fi
echo -e "${GREEN}✔️ All validations passed successfully.${NO_COLOR}"
rm check_failures # Clean up
shell: bash

0 comments on commit bf7ab00

Please sign in to comment.