diff --git a/json-schema-check/action.yaml b/json-schema-check/action.yaml index 716f2b95..8b861a2f 100644 --- a/json-schema-check/action.yaml +++ b/json-schema-check/action.yaml @@ -16,25 +16,30 @@ runs: baseName="${schemaFile##*/}" # Extract just the file name baseName="${baseName%.schema.json}" # Remove the schema.json extension - + # Determine the directory of the schema and switch to corresponding config directory configDir="${schemaFile%/*}" # Get the directory path for schema, without leading ./ configDir="${configDir/schema/config}" # Switch to config directory - + shopt -s nullglob # Enable nullglob to handle no matches as an empty array configFiles=("${configDir}/${baseName}"*.param.yaml) # Pattern match for config files - + errorFlag=0 # Flag to track validation failures - + for configFile in "${configFiles[@]}"; do - echo "Validating $configFile against $schemaFile" # Log validation action - if ! check-jsonschema --schemafile "$schemaFile" "$configFile"; then - errorFlag=1 # Set error flag on validation failure + echo -n "Validating: $configFile <-> $schemaFile => " + if check-jsonschema --schemafile "$schemaFile" "$configFile"; then + # If validation succeeds, print success message + echo "✅ Passed" + else + # If validation fails, set error flag and print failure message + errorFlag=1 + echo "❌ Failed" fi done - + if [ "$errorFlag" -ne 0 ]; then - echo "Validation errors found" >&2 # Print error message to stderr + echo "❗ Validation encountered errors." >&2 # Print error message to stderr exit 1 # Exit with error to fail the workflow step fi ' bash {} \;