Merge pull request #401 from nubenetes/fix/guardian-skip-generated-v2docs

fix(ci): PR Guardian must not auto-format the generated v2-docs/ tree
This commit is contained in:
Inaki
2026-06-20 12:15:59 +02:00
committed by GitHub
2 changed files with 11 additions and 2 deletions

View File

@@ -59,7 +59,10 @@ jobs:
run: |
git config --global user.name "nubenetes-bot"
git config --global user.email "bot@nubenetes.com"
git add docs/ v2-docs/ README.md data/inventory.yaml data/inventory.sql src/memory/
# NOTE: v2-docs/ is deliberately excluded. It is generated by
# src/v2_optimizer.py (single source of truth); re-formatting it here
# caused a perpetual cosmetic develop<->master drift (see pr_guardian.py).
git add docs/ README.md data/inventory.yaml data/inventory.sql src/memory/
if ! git diff --cached --quiet; then
git commit -m "style(cleaner): auto-correcting formatting & URL normalization"
git push origin HEAD:${{ github.event.pull_request.head.ref }} || echo "⚠️ Push failed (likely fork permission limit)."

View File

@@ -95,7 +95,13 @@ def main():
files = pr.get_files()
modified_files = [f.filename for f in files if f.status in ["modified", "added"]]
for filepath in modified_files:
if filepath.endswith(".md"):
# The v2-docs/ tree is generated by src/v2_optimizer.py, which is its
# single source of truth for formatting. Auto-formatting it here
# ("&"->"and" in headings, URL trailing-slash stripping) only fights
# the generator: the rewrite lands on develop via the PR while master
# gets the generator's raw form via release merges, producing a
# perpetual cosmetic develop<->master drift. Skip the generated tree.
if filepath.endswith(".md") and not filepath.startswith("v2-docs/"):
auto_format_file(filepath)
except Exception as e:
print(f"Warning: Failed to fetch files for auto-formatting: {e}")