fix(ci): replace yq with Python nav patching in publish-devnotes#548
fix(ci): replace yq with Python nav patching in publish-devnotes#548andreatgretel merged 1 commit intomainfrom
Conversation
The yq JSON roundtrip was mangling the entire mkdocs.yml file (indentation, quoting, comments), causing mike deploy to fail. Extract a Python script that surgically replaces only the Dev Notes nav block, leaving all other content byte-identical.
Code Review: PR #548 — fix(ci): replace yq with Python nav patching in publish-devnotesSummaryThis PR replaces a Files changed: 2 (+60, −5)
Findings1. Block-end detection may stop too early on comment lines (Medium)File: The while-loop that detects the end of the Dev Notes block checks whether a line starts with 6 spaces ( - Dev Notes:
# NOTE: Order is most recent -> oldest ...
- devnotes/index.mdThe condition on line 31 is: if lines[end].strip() and not lines[end].startswith(" ") and not lines[end].startswith(" #"):The comment 2. Regex anchors match only exactly 2-space-indented
|
Greptile SummaryThis PR replaces the
|
| Filename | Overview |
|---|---|
| .github/scripts/patch-devnotes-nav.py | New Python script that surgically replaces only the Dev Notes nav block in mkdocs.yml; indentation assumptions (6-space children) match the actual file format. |
| .github/workflows/publish-devnotes.yml | Drops yq install and JSON-roundtrip in favour of the new Python script; also checks out the script from HEAD alongside devnotes so it is always available. |
Sequence Diagram
sequenceDiagram
participant WF as publish-devnotes.yml
participant Git as git
participant Py as patch-devnotes-nav.py
participant FS as mkdocs.yml (target)
WF->>Git: checkout SOURCE_SHA (old source)
WF->>Git: checkout github.sha -- docs/devnotes/ + patch script
WF->>Git: "git show github.sha:mkdocs.yml > /tmp/mkdocs-head.yml"
WF->>Py: python3 patch-devnotes-nav.py /tmp/mkdocs-head.yml mkdocs.yml
Py->>Py: extract_devnotes_block(head) → head_block lines
Py->>FS: extract_devnotes_block(target) → old block range
Py->>FS: splice head_block into target, write back
WF->>WF: mike deploy (uses patched mkdocs.yml)
Reviews (1): Last reviewed commit: "fix(ci): replace yq with Python nav patc..." | Re-trigger Greptile
…DIA-NeMo#548) The yq JSON roundtrip was mangling the entire mkdocs.yml file (indentation, quoting, comments), causing mike deploy to fail. Extract a Python script that surgically replaces only the Dev Notes nav block, leaving all other content byte-identical.
Summary
yqJSON roundtrip with a Python script (.github/scripts/patch-devnotes-nav.py) that surgically replaces only the Dev Notes nav block inmkdocs.ymlyqapproach was mangling the entire file (indentation, quoting, comments), causingmike deployto failFollow-up fix to #546