Skip to content

Commit

Permalink
Add . as allowed, add _index.md as exception
Browse files Browse the repository at this point in the history
  • Loading branch information
marians committed Dec 13, 2024
1 parent ce2238c commit 85e6994
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions .github/workflows/validate.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -87,19 +87,21 @@ jobs:
import os
import sys
allowed_chars = re.compile(r'^[a-z0-9-]+$')
allowed_chars = re.compile(r'^[a-z0-9-\.+]+$')
content_dir = 'src/content'
errors = []
for root, dirs, files in os.walk(content_dir):
for file in files:
full_path = Path(root, file)
if full_path.suffix.lower() != '.md':
continue
if full_path.name == '_index.md':
continue
if not allowed_chars.match(full_path.stem):
errors.append(f"- File name {full_path}' contains invalid characters. Only lowercase letters, digits, and hyphens are allowed.\n")
errors.append(f"- {full_path}'\n")
if len(errors) > 0:
print("The following file names use invalid characters. Only lowercase letters, digits, and hyphens are allowed.\n\n")
print("The following file names use invalid characters. Only lowercase letters, digits, hyphens and period are allowed.\n\n")
for error in errors:
print(error)
sys.exit(1)
Expand Down

0 comments on commit 85e6994

Please sign in to comment.