fix(ci): replace yq with surgical Python nav patching#547
Closed
andreatgretel wants to merge 3 commits intomainfrom
Closed
fix(ci): replace yq with surgical Python nav patching#547andreatgretel wants to merge 3 commits intomainfrom
andreatgretel wants to merge 3 commits intomainfrom
Conversation
- Update post date from 2026-03-11 to 2026-04-14 so it appears as the newest post on the devnotes page. - Replace raw <img> tags with markdown image syntax so mkdocs rewrites relative paths correctly for the blog plugin's slug-based URLs. - Overlay mkdocs.yml from HEAD in publish-devnotes workflow so new nav entries are included in devnotes-only rebuilds.
…otes The yq JSON roundtrip was mangling the entire mkdocs.yml file (indentation, quoting, comments), causing mike deploy to fail. Replace with a Python script that extracts only the Dev Notes nav block from HEAD's mkdocs.yml and splices it into the old source's copy, leaving all other content byte-identical.
Move the inline Python heredoc from publish-devnotes.yml into .github/scripts/patch-devnotes-nav.py. The workflow checks out the script from HEAD alongside the devnotes content.
johnnygreco
approved these changes
Apr 14, 2026
Contributor
Greptile SummaryThis PR replaces a
|
| Filename | Overview |
|---|---|
| .github/scripts/patch-devnotes-nav.py | New Python script that surgically extracts and splices the Dev Notes nav block; boundary detection correctly handles 6-space-indented sub-items (matching the actual mkdocs.yml), blank lines, and comment lines. Logic is sound and idempotent. |
| .github/workflows/publish-devnotes.yml | Replaces yq roundtrip with the new Python patch script; correctly checks out patch-devnotes-nav.py from HEAD alongside devnotes, writes HEAD's mkdocs.yml to /tmp, and invokes the script against the old source's mkdocs.yml. |
| docs/devnotes/posts/text-to-sql.md | Documentation-only changes: updated date, converted raw HTML img tags to MkDocs Material attribute syntax, updated a URL, and trimmed two reference links. |
Sequence Diagram
sequenceDiagram
participant GH as GitHub Actions
participant GHP as gh-pages branch
participant Repo as Repository
participant Tmp as /tmp
participant Script as patch-devnotes-nav.py
participant MkDocs as mkdocs.yml (old source)
GH->>GHP: "fetch origin gh-pages --depth=1"
GHP-->>GH: last deploy commit (SOURCE_SHA, VERSION)
GH->>Repo: git checkout SOURCE_SHA
Repo-->>GH: old source state
GH->>Repo: git checkout github.sha -- docs/devnotes/ .github/scripts/patch-devnotes-nav.py
Repo-->>GH: new devnotes + patch script overlaid
GH->>Repo: git show github.sha:mkdocs.yml
Repo-->>Tmp: mkdocs-head.yml (HEAD nav)
GH->>Script: python3 patch-devnotes-nav.py /tmp/mkdocs-head.yml mkdocs.yml
Script->>Tmp: extract Dev Notes block from HEAD mkdocs.yml
Script->>MkDocs: extract Dev Notes block from old mkdocs.yml
Script->>MkDocs: splice HEAD block into old file (surgical replace)
MkDocs-->>GH: patched mkdocs.yml (only Dev Notes nav updated)
GH->>GH: mike deploy --push --update-aliases VERSION latest
Reviews (1): Last reviewed commit: "refactor(ci): extract nav patching into ..." | Re-trigger Greptile
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.
Summary
yqJSON roundtrip with Python-based text replacement inpublish-devnotes.ymlyqapproach was mangling the entiremkdocs.yml(indentation, quoting, comments), causingmike deployto failFollow-up to #546