Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions .ci/scripts/docgen.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,14 +36,14 @@ def load_policy_metadata(file_path: str) -> PolicyMetadata:

def generate_markdown_table(policies: List[PolicyMetadata]) -> str:
"""Generate a Markdown table from a list of PolicyMetadata objects."""
header = "| URL | Version | Description | Link |\n"
separator = "|------------|----------|-----------|---------| \n"
header = "| URL | Description | Link |\n"
separator = "|------------|-----------|---------| \n"
rows = []
for p in policies:
description = p.description.replace("\n", " ").strip()
ghcr_path = f"ghcr.io/{os.path.normpath(os.path.dirname(p.path))}"
readme_url = replace_filename_in_url(f"https://github.com/updatecli/policies/tree/main/{p.path}", "README.md")
rows.append(f"| `{ghcr_path or '-'}` | {p.version or '-'} | {description or '-'} | {f"[link]({readme_url})" } |")
rows.append(f"| `{ghcr_path}@{p.version}` | {description or '-'} | {f"[link]({readme_url})" } |")
return header + separator + "\n".join(rows)

def replace_filename_in_url(url: str, new_filename: str) -> str:
Expand Down