Skip to content

Commit ca81f8c

Browse files
committed
Fix syntax error
1 parent fadef9b commit ca81f8c

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

.github/workflows/consolidate-snippets.yml

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,11 +16,18 @@ jobs:
1616
- name: Checkout repository
1717
uses: actions/checkout@v3
1818

19+
- name: Install jq (for JSON manipulation)
20+
run: sudo apt-get install -y jq
21+
1922
- name: Consolidate JSON files
2023
run: |
2124
mkdir -p public/consolidated
2225
echo "[" > public/consolidated/all_snippets.json
23-
find public/data -name "*.json" ! -name "_index.json" -exec sh -c 'jq -c ".[]" {} | sed "s/^/{\"language\": \"$(basename {} .json)\", /" | sed "s/}/},/" >> public/consolidated/all_snippets.json' \;
26+
find public/data -name "*.json" ! -name "_index.json" -exec sh -c '
27+
for file; do
28+
jq -c ".[]" "$file" | sed "s/^/{\"language\": \"$(basename "$file" .json)\", /" | sed "s/}/},/" >> public/consolidated/all_snippets.json
29+
done
30+
' _ {} +
2431
sed -i '$ s/,$//' public/consolidated/all_snippets.json
2532
echo "]" >> public/consolidated/all_snippets.json
2633

0 commit comments

Comments
 (0)