diff --git a/.github/workflows/validate.yaml b/.github/workflows/validate.yaml index cdf0771e83..a9556f4cff 100644 --- a/.github/workflows/validate.yaml +++ b/.github/workflows/validate.yaml @@ -88,6 +88,8 @@ jobs: import sys allowed_chars = re.compile(r'^[a-z0-9-\.+]+$') + allowed_chars_static = re.compile(r'^[a-z0-9-\._]+$') # images etc. may use the underscore + content_dir = 'src/content' errors = [] for root, dirs, files in os.walk(content_dir): @@ -95,15 +97,23 @@ jobs: full_path = Path(root, file) if full_path.name == '_index.md': continue - if not allowed_chars.match(full_path.stem): - errors.append(f"- {full_path}'\n") + if full_path.name == '_template.md.tpl': + continue + + if full_path.suffix.lower() == '.md': + if not allowed_chars.match(full_path.stem): + errors.append(f"- FILE {full_path}'") + else: + # static files + if not allowed_chars_static.match(full_path.name): + errors.append(f"- FILE {full_path}'") for dir in dirs: if not allowed_chars.match(dir): - errors.append(f"- {Path(root, dir)}'\n") + errors.append(f"- DIR {Path(root, dir)}'") if len(errors) > 0: - print("The following file/folder 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") for error in errors: print(error) sys.exit(1)