Skip to content

Commit

Permalink
Try nested folders
Browse files Browse the repository at this point in the history
  • Loading branch information
ChristopherWMM committed Aug 23, 2024
1 parent 69378d3 commit be001e4
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 21 deletions.
46 changes: 26 additions & 20 deletions .github/workflows/github-pages-deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,34 +23,40 @@ jobs:
run: npm i -g @slidev/cli
- name: Get modified slide directories
run: |
# Get the list of modified slide markdown files
modified_files=$(git show ${{ github.sha }} --name-only | grep "^slides/.*/.*\.\(md\|vue\|ts\|tsx\|js\|jsx\|html\|css\)$")
# Get the list of modified files
modified_files=$(git show ${{ github.sha }} --name-only | grep "^slides/.*/.*\.\(md\|vue\|ts\|tsx\|js\|jsx\|html\|css\)$")
echo "Modified files: $modified_files"
echo "Modified files: $modified_files"
# Temporary file to store directories
temp_file=$(mktemp)
# Temporary file to store directories
temp_file=$(mktemp)
# Loop through modified files and extract their directories
for file in $modified_files; do
dir=$(dirname $file)
first_two_parts=$(echo "$dir" | awk -F'/' '{print $1 "/" $2}')
# Add directory to temporary file
echo "$first_two_parts" >> "$temp_file"
done
# Loop through modified files and find the closest parent directory with a markdown file
for file in $modified_files; do
dir=$(dirname "$file")
echo "Modified directories: $temp_file"
# Traverse up the directory tree to find a parent with a .md file
while [ "$dir" != "." ]; do
if ls "$dir"/*.md >/dev/null 2>&1; then
echo "$dir" >> "$temp_file"
break
fi
dir=$(dirname "$dir")
done
done
echo "Directories with markdown files: $(cat $temp_file)"
# Remove duplicates and store the result in modified_dirs
modified_dirs=$(sort "$temp_file" | uniq | tr '\n' ' ')
# Remove duplicates and store the result in modified_dirs
modified_dirs=$(sort "$temp_file" | uniq | tr '\n' ' ')
# Clean up temporary file
rm "$temp_file"
# Clean up temporary file
rm "$temp_file"
echo "Unique modified directories: $modified_dirs"
echo "Unique modified directories: $modified_dirs"
# Output the modified directories to be used as an environment variable
echo "modified_dirs=${modified_dirs}" >> $GITHUB_ENV
# Output the modified directories to be used as an environment variable
echo "modified_dirs=${modified_dirs}" >> $GITHUB_ENV
- name: Create build directory
run: |
Expand Down
2 changes: 1 addition & 1 deletion slides/week_01/test1/slides.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
---
title: Test1
title: Test 1
layout: intro
---

Expand Down
2 changes: 2 additions & 0 deletions slides/week_01/test2/slides.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ title: Test 2
layout: intro
---

# Test 2

```python {monaco-run} {autorun:true}
import math

Expand Down

0 comments on commit be001e4

Please sign in to comment.