Skip to content

Commit 4a29b13

Browse files
authored
Merge pull request #1862 from annietllnd/fix
Allow capitalization in file extensions
2 parents b16e5ec + 76f0ab8 commit 4a29b13

File tree

1 file changed

+24
-6
lines changed

1 file changed

+24
-6
lines changed

.github/workflows/test-lp.yml

Lines changed: 24 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -20,16 +20,34 @@ jobs:
2020
**.md
2121
- name: Check for capital letters or spaces in content directory
2222
run: |
23-
echo "Checking for capital letters or spaces in content directory paths..."
23+
echo "Checking for capital letters or spaces in content directory paths (excluding file extensions)..."
24+
25+
tmpfile=$(mktemp)
2426
2527
git diff --name-only origin/${{ github.base_ref }}...HEAD |
2628
grep '^content/' |
27-
grep -E '[A-Z]|[[:space:]]' && {
28-
echo "❌ Found invalid file or directory names with capital letters or spaces in 'content/'"
29-
exit 1
30-
}
29+
while read -r path; do
30+
name=$(basename "$path")
31+
32+
# Strip file extension if it exists
33+
base="${name%.*}"
34+
35+
if [[ "$base" =~ [A-Z] || "$base" =~ [[:space:]] ]]; then
36+
echo "Invalid name: $path"
37+
echo "$path" >> "$tmpfile"
38+
fi
39+
done
40+
41+
if [[ -s "$tmpfile" ]]; then
42+
echo "❌ One or more files or directories in 'content/' contain capital letters or spaces (excluding extensions):"
43+
cat "$tmpfile"
44+
rm "$tmpfile"
45+
exit 1
46+
else
47+
rm "$tmpfile"
48+
echo "✅ No capital letters or spaces found in 'content/' paths."
49+
fi
3150
32-
echo "✅ No capital letters or spaces found in 'content/' paths."
3351
- name: Install dependencies
3452
if: steps.changed-markdown-files.outputs.any_changed == 'true'
3553
run: pip install -r tools/requirements.txt

0 commit comments

Comments
 (0)