diff --git a/.github/scripts/sync-wiki.py b/.github/scripts/sync-wiki.py index ebf543c7..51f3e404 100644 --- a/.github/scripts/sync-wiki.py +++ b/.github/scripts/sync-wiki.py @@ -5,6 +5,7 @@ from pathlib import Path DOCS_DIR = Path("docs") WIKI_DIR = Path("wiki-temp") +LATEST_DIR = DOCS_DIR / "(git)" FRONTMATTER_RE = re.compile(r"\A---\s*\n.*?^---\s*\n", re.DOTALL | re.MULTILINE) DOCS_LINK_RE = re.compile(r"\[([^\]]+)\]\(/docs/(?:[^/)]+/)*([^/)#]+)(#[^)]+)?\)") @@ -20,10 +21,10 @@ def collect_all_files() -> list[tuple[Path, str]]: return [directory / f"{p}.md" for p in data.get("pages", []) if (directory / f"{p}.md").exists()] return sorted(directory.glob("*.md")) - for src in from_dir(DOCS_DIR): + for src in from_dir(LATEST_DIR): files.append((src, "Home" if src.stem == "index" else src.stem)) - for subdir in sorted(DOCS_DIR.iterdir()): + for subdir in sorted(LATEST_DIR.iterdir()): if subdir.is_dir(): for src in from_dir(subdir): files.append((src, src.stem)) @@ -44,7 +45,7 @@ def main() -> None: lines: list[str] = [] current_section = None for src, dest_name in files: - section = "General" if src.parent == DOCS_DIR else src.parent.name.replace("-", " ").title() + section = "General" if src.parent == LATEST_DIR else src.parent.name.replace("-", " ").title() if section != current_section: if current_section is not None: lines.append("") diff --git a/.github/workflows/generate-nix-options-docs.yml b/.github/workflows/generate-nix-options-docs.yml index 7249ef46..ff6006c1 100644 --- a/.github/workflows/generate-nix-options-docs.yml +++ b/.github/workflows/generate-nix-options-docs.yml @@ -53,11 +53,11 @@ jobs: python3 ./.github/scripts/generate-nix-options-docs.py \ /tmp/nixos-raw.md \ /tmp/hm-raw.md \ - docs/nix-options.md + 'docs/(git)/nix-options.md' - name: Auto-commit changes uses: stefanzweifel/git-auto-commit-action@v5 with: commit_message: "docs: auto-generate Nix module options" - file_pattern: 'docs/*-options.md' + file_pattern: 'docs/**/nix-options.md' branch: ${{ github.head_ref }}