Skip to content

Commit

Permalink
Extend checks to folder names
Browse files Browse the repository at this point in the history
  • Loading branch information
marians committed Dec 13, 2024
1 parent 85e6994 commit 03d4cfc
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions .github/workflows/validate.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ jobs:
exit 1
fi
- name: Check file names
- name: Check file and folder names in content
shell: python {0}
continue-on-error: true
run: |
Expand All @@ -93,15 +93,17 @@ jobs:
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"- {full_path}'\n")
for dir in dirs:
if not allowed_chars.match(dir):
errors.append(f"- {Path(root, dir)}'\n")
if len(errors) > 0:
print("The following file names use invalid characters. Only lowercase letters, digits, hyphens and period are allowed.\n\n")
print("The following file/folder 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 03d4cfc

Please sign in to comment.