Skip to content

Commit 9079d68

Browse files
authored
Merge pull request #6 from yusufk/development
Improve article indexing workflow by removing old index and condition…
2 parents a11361a + a2864a5 commit 9079d68

1 file changed

Lines changed: 7 additions & 1 deletion

File tree

.github/workflows/articles.yml

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,13 @@ jobs:
2222
for dir in */; do
2323
if [ -d "$dir" ]; then
2424
cd "$dir"
25-
ls *.md 2>/dev/null | jq -R -s -c 'split("\n")[:-1]' > index.json
25+
# Remove old index
26+
rm -f index.json
27+
# Create new index only if markdown files exist
28+
if find . -maxdepth 1 -name "*.md" | grep -q .; then
29+
find . -maxdepth 1 -name "*.md" -exec basename {} \; | \
30+
jq -R -s -c 'split("\n")[:-1]' > index.json
31+
fi
2632
cd ..
2733
fi
2834
done

0 commit comments

Comments
 (0)