DYN-9484 Autoreplace HTMLs#16504
Conversation
This new github workflow will check if a pull request merged has updated any file under the subfolders of doc/distrib/html/*/**, if that is the case then will create another PR that will be updating the files in the corresponding folder under src/, in this way the developer will only focus in updating the html files under doc/distrib/html/.
There was a problem hiding this comment.
See the ticket for this pull request: https://jira.autodesk.com/browse/DYN-9484
There was a problem hiding this comment.
Pull Request Overview
Adds a new GitHub Actions workflow to automatically mirror updated HTML documentation from doc/distrib/html into corresponding files under src/ by opening a follow-up PR after a documentation-related PR is merged into master.
- Detects changed .html files in doc/distrib/html after a PR merge.
- Maps those to existing files under src/ (by language) and overwrites them, then opens an automated PR with the updates.
| filename = os.path.basename(f) | ||
|
|
||
| # Get the language of the current file | ||
| lang_match = [p for p in lang_dirs if p in f][0] |
There was a problem hiding this comment.
Using substring containment (p in f) risks incorrect matches (e.g., language code 'en' matching an unrelated path segment). Parse the path segments and require an exact directory match after doc/distrib/html to avoid accidental misclassification. Use something like:
parts = f.split('/')
if len(parts) > 3:
candidate = parts[3]
if candidate in lang_dirs:
lang_match = candidate
else:
print(f"No exact language directory match for {f}")
continue| lang_match = [p for p in lang_dirs if p in f][0] | |
| parts = f.split('/') | |
| if len(parts) > 3: | |
| candidate = parts[3] | |
| if candidate in lang_dirs: | |
| lang_match = candidate | |
| else: | |
| print(f"No exact language directory match for {f}") | |
| continue | |
| else: | |
| print(f"Path {f} does not have enough segments to determine language directory") | |
| continue |
| for f in file_map: | ||
| src_path = f[0] | ||
| dest_path = f[1] | ||
| # Copy the file to destination | ||
| shutil.copy2(src_path, dest_path) | ||
| print(f"Copied {src_path} -> {dest_path}") |
There was a problem hiding this comment.
Deletions or renames in doc/distrib/html are not propagated; stale files under src/ will persist. Consider comparing the set of expected html files per language and removing (or flagging) files in src/ that no longer exist at source. Add logic to detect removed originals and either delete or open an issue/PR note.
|
|
||
| # Create new branch | ||
| git checkout -b $BRANCH | ||
| git add . |
There was a problem hiding this comment.
Using git add . may include unrelated files (e.g., transient changes, generated artifacts) leading to noisy automated PRs. Restrict the add to only the mapped destination files (tracked during copy) or to patterns (e.g., git add src/**/*.html) to minimize risk.
| git add . | |
| # Add only the destination files from FILE_MAP | |
| DEST_FILES=$(echo "$FILE_MAP" | python3 -c "import sys, json; print(' '.join([f[1] for f in json.load(sys.stdin).items()]))" 2>/dev/null || echo "") | |
| if [[ -n "$DEST_FILES" ]]; then | |
| git add $DEST_FILES | |
| fi |
Co-authored-by: Copilot <[email protected]>
Co-authored-by: Copilot <[email protected]>
Code Review changes
|
All tests Passed in DYN-DevCI_Self_Service job |
Purpose
This new github workflow will check if a pull request merged has updated any file under the subfolders of doc/distrib/html/*/**, if that is the case then will create another PR that will be updating the files in the corresponding folder under src/, in this way the developer will only focus in updating the html files under doc/distrib/html/.
Declarations
Check these if you believe they are true
Release Notes
adding a new github workflow for adding the html documentation under src/ folder
Reviewers
@QilongTang @reddyashish @zeusongit @avidit
FYIs