Skip to content

Commit

Permalink
Add changelog for nested pkgs pointing to shared changes
Browse files Browse the repository at this point in the history
For packages which are nested under some repository and share the
changelog file, added a page with the link to the right changelog.

[noissue]
  • Loading branch information
pedro-psb committed May 9, 2024
1 parent 4b3d0bb commit d2ca4c7
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions src/pulp_docs/mkdocs_macros.py
Original file line number Diff line number Diff line change
Expand Up @@ -144,13 +144,11 @@ def _place_doc_files(src_dir: Path, docs_dir: Path, repo: Repo):

try:
shutil.copytree(src_dir / SRC_DOCS_DIRNAME, docs_dir / "docs")

except FileNotFoundError:
Path(docs_dir / "docs").mkdir(parents=True)
repo.status.has_staging_docs = False

# Get CHANGELOG
# TODO: remove reading .rst (plugins should provide markdown CHANGELOG)
# Get changelog
repo.status.has_changelog = False
changes_dir = Path(docs_dir / "changes")
changes_dir.mkdir(exist_ok=True)
Expand All @@ -161,6 +159,15 @@ def _place_doc_files(src_dir: Path, docs_dir: Path, repo: Repo):
repo.status.has_changelog = True
return

# Create redirect message for nested packages
if isinstance(repo, SubPackage):
empty_changelog = changes_dir / "changelog.md"
changes_url = f"site:{repo.subpackage_of}/changes/changelog/"
empty_changelog.write_text(
f"# Changelog\n\nThe changelog for this package is nested under [{repo.subpackage_of}]({changes_url})."
)
return

# Create placeholder, case it was not possible to fetch one
empty_changelog = changes_dir / "changelog.md"
empty_changelog.write_text(
Expand Down

0 comments on commit d2ca4c7

Please sign in to comment.