Skip to content

Commit

Permalink
Amend test scripts
Browse files Browse the repository at this point in the history
  • Loading branch information
thatkev committed Apr 20, 2024
1 parent 1558060 commit 397fd13
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 9 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/validate-slash_commands.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,4 @@ jobs:
- uses: actions/checkout@v2

- name: Validate JSON files
run: bash ./scripts/validate-slash_commands.sh ./slash-commands
run: bash ./scripts/validate-slash_commands.sh ./slash_commands
8 changes: 0 additions & 8 deletions scripts/validate-slash_commands.sh
Original file line number Diff line number Diff line change
@@ -1,15 +1,8 @@
#!/bin/bash
ls

# Directory containing JSON files
directory=$1

# Flag to track validation status
valid=true

# Iterate through all JSON files in the directory
for file in "$directory"/*.json; do
# Use jq to recursively find any 'name' fields that are strings and contain spaces
results=$(jq -r 'recurse | objects | .name? | select(.) | with_entries(select(.value | test(" "))) | keys[]' "$file")

if [ ! -z "$results" ]; then
Expand All @@ -20,7 +13,6 @@ for file in "$directory"/*.json; do
fi
done

# Exit with error if any file failed validation
if [ "$valid" = false ]; then
echo "Validation errors found in some JSON files."
exit 1
Expand Down

0 comments on commit 397fd13

Please sign in to comment.