Skip to content

Commit

Permalink
style(pre-commit): autofix
Browse files Browse the repository at this point in the history
  • Loading branch information
pre-commit-ci[bot] authored and M. Fatih Cırıt committed Feb 20, 2024
1 parent 1cf1142 commit 71f4178
Showing 1 changed file with 14 additions and 9 deletions.
23 changes: 14 additions & 9 deletions json-schema-check/action.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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

Check warning on line 24 in json-schema-check/action.yaml

View workflow job for this annotation

GitHub Actions / spell-check-differential

Unknown word (shopt)

Check warning on line 24 in json-schema-check/action.yaml

View workflow job for this annotation

GitHub Actions / spell-check-differential

Unknown word (nullglob)

Check warning on line 24 in json-schema-check/action.yaml

View workflow job for this annotation

GitHub Actions / spell-check-differential

Unknown word (nullglob)
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 {} \;
Expand Down

0 comments on commit 71f4178

Please sign in to comment.