Skip to content

Commit d2ca4c7

Browse files
committed
Add changelog for nested pkgs pointing to shared changes
For packages which are nested under some repository and share the changelog file, added a page with the link to the right changelog. [noissue]
1 parent 4b3d0bb commit d2ca4c7

File tree

1 file changed

+10
-3
lines changed

1 file changed

+10
-3
lines changed

src/pulp_docs/mkdocs_macros.py

+10-3
Original file line numberDiff line numberDiff line change
@@ -144,13 +144,11 @@ def _place_doc_files(src_dir: Path, docs_dir: Path, repo: Repo):
144144

145145
try:
146146
shutil.copytree(src_dir / SRC_DOCS_DIRNAME, docs_dir / "docs")
147-
148147
except FileNotFoundError:
149148
Path(docs_dir / "docs").mkdir(parents=True)
150149
repo.status.has_staging_docs = False
151150

152-
# Get CHANGELOG
153-
# TODO: remove reading .rst (plugins should provide markdown CHANGELOG)
151+
# Get changelog
154152
repo.status.has_changelog = False
155153
changes_dir = Path(docs_dir / "changes")
156154
changes_dir.mkdir(exist_ok=True)
@@ -161,6 +159,15 @@ def _place_doc_files(src_dir: Path, docs_dir: Path, repo: Repo):
161159
repo.status.has_changelog = True
162160
return
163161

162+
# Create redirect message for nested packages
163+
if isinstance(repo, SubPackage):
164+
empty_changelog = changes_dir / "changelog.md"
165+
changes_url = f"site:{repo.subpackage_of}/changes/changelog/"
166+
empty_changelog.write_text(
167+
f"# Changelog\n\nThe changelog for this package is nested under [{repo.subpackage_of}]({changes_url})."
168+
)
169+
return
170+
164171
# Create placeholder, case it was not possible to fetch one
165172
empty_changelog = changes_dir / "changelog.md"
166173
empty_changelog.write_text(

0 commit comments

Comments
 (0)