Fix nested release docs paths#334
Merged
Merged
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR updates the docs site merge script to handle GitHub Pages “repo-prefixed” nested version directories (e.g., build/html/EmbodiChain/v0.2.2) so release versions are discovered and included in versions.json after cache restore / wget downloads.
Changes:
- Add
flatten_nested_version_dirs()to promote nestedv*directories to the build root and clean up empty directories. - Adjust
_download_version_wget()to attempt to use partially downloaded content even whenwgetexits non-zero (e.g., exit 8), including flattening + normalization. - Add tests covering cache-restored nested directories and the
wgetnon-zero exit salvage behavior.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| docs/scripts/merge_published_site.py | Adds nested version directory flattening, reuses cleanup helper, and updates wget handling to proceed on partial downloads. |
| tests/docs/conftest.py | Exposes flatten_nested_version_dirs from the script module for tests. |
| tests/docs/test_merge_published_site.py | Adds regression tests for flattening nested cached versions and salvaging wget exit 8 output. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
+155
to
+163
| for candidate in candidates: | ||
| target = build_dir / candidate.name | ||
| if target.exists(): | ||
| shutil.rmtree(candidate) | ||
| changes.append((candidate, None)) | ||
| else: | ||
| candidate.rename(target) | ||
| changes.append((candidate, target)) | ||
|
|
Comment on lines
191
to
193
| if result.returncode != 0: | ||
| print(f"wget failed for {url} (exit {result.returncode})", file=sys.stderr) | ||
| return | ||
|
|
Promote repo-prefixed version directories restored from cache or partially downloaded by wget so versions.json discovers release docs at the top-level path.
ff089ff to
968aada
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
This PR fixes the release docs disappearing from the published version selector after the docs artifact upload fix.
Root cause from the successful main run
28218982772:wget -nHpreserved the GitHub Pages repository path and produceddocs/build/html/EmbodiChain/v0.2.2wgetreturned exit8after downloading usable pages, so the previous script returned before promoting that nested directorygenerate_versions_json.pyonly scans top-levelv*directories, so it generated a manifest with onlymainThis PR flattens repo-prefixed release directories from restored cache and partially downloaded
wgetoutput beforeversions.jsonis generated.Dependencies: none
Fixes the live docs issue where
v0.2.2is deployed under/EmbodiChain/EmbodiChain/v0.2.2/instead of/EmbodiChain/v0.2.2/.Type of change
Screenshots
N/A
Checklist
black .command to format the code base.Verification
black .black --check docs/scripts/merge_published_site.py tests/docs/conftest.py tests/docs/test_merge_published_site.pypytest tests/docs -q --confcutdir=tests/docs