mirror of
https://github.com/polarity-lang/polarity.git
synced 2025-07-07 21:15:04 +00:00

* Add examples/index.json * Ensure examples index remains in sync * Improve script output * Set permissions in .github/workflows/examples-index.yml
17 lines
582 B
Bash
Executable file
17 lines
582 B
Bash
Executable file
#!/bin/bash
|
|
set -euo pipefail
|
|
|
|
# Get the list of .pol files in the examples directory
|
|
pol_files=$(find examples -maxdepth 1 -name "*.pol" -printf "%f\n" | sort)
|
|
|
|
# Extract the 'path' entries from index.json
|
|
index_paths=$(jq -r '.[].path' examples/index.json | sort)
|
|
|
|
# Compare the two lists
|
|
if diff <(echo "$pol_files") <(echo "$index_paths") >/dev/null; then
|
|
echo "Success: examples/index.json and examples/*.pol files are in sync."
|
|
else
|
|
echo "Error: examples/index.json and examples/*.pol are not in sync."
|
|
echo "Diff:"
|
|
diff <(echo "$pol_files") <(echo "$index_paths")
|
|
fi
|