diff --git a/.github/workflows/update_directory_md.yml b/.github/workflows/update_directory_md.yml index 5eca9aa..83732bd 100644 --- a/.github/workflows/update_directory_md.yml +++ b/.github/workflows/update_directory_md.yml @@ -13,17 +13,17 @@ jobs: from typing import Iterator URL_BASE = "https://github.com/TheAlgorithms/Ruby/blob/master" g_output = [] - + def good_filepaths(top_dir: str = ".") -> Iterator[str]: for dirpath, dirnames, filenames in os.walk(top_dir): dirnames[:] = [d for d in dirnames if d[0] not in "._"] for filename in filenames: if os.path.splitext(filename)[1].lower() == ".rb": yield os.path.join(dirpath, filename).lstrip("./") - + def md_prefix(i): return f"{i * ' '}*" if i else "\n##" - + def print_path(old_path: str, new_path: str) -> str: global g_output old_parts = old_path.split(os.sep) @@ -32,7 +32,7 @@ jobs: if new_part: g_output.append(f"{md_prefix(i)} {new_part.replace('_', ' ').title()}") return new_path - + def build_directory_md(top_dir: str = ".") -> str: global g_output old_path = "" @@ -47,7 +47,7 @@ jobs: return "\n".join(g_output) with open("DIRECTORY.md", "w") as out_file: out_file.write(build_directory_md(".") + "\n") - + - name: Update DIRECTORY.md run: | cat DIRECTORY.md