diff options
| author | Yuriy Andamasov <yuriy@vyos.io> | 2026-05-11 01:25:48 +0300 |
|---|---|---|
| committer | Yuriy Andamasov <yuriy@vyos.io> | 2026-05-11 01:25:48 +0300 |
| commit | 5e2f6ab327ed24d6ea66ed91e0d6506524778230 (patch) | |
| tree | 0acd132058ccba8133729e97eaa87a1faf110632 | |
| parent | ea41c7f3fc6137c1b0a5cabb1455ad03f6cc6e1b (diff) | |
| download | vyos-documentation-5e2f6ab327ed24d6ea66ed91e0d6506524778230.tar.gz vyos-documentation-5e2f6ab327ed24d6ea66ed91e0d6506524778230.zip | |
ci(ai-validation): cover deletion-only Markdown PRs
CodeRabbit caught a real Major issue on this PR's first version:
has_md_changes was derived from changed-md.txt, which is built with
--diff-filter=ACMRT (excludes Deletes). A PR that only deletes
docs/**/*.md files would set has_md_changes=false and skip validate
entirely — but Pass 1 reviews the diff (via --pr-diff
../diff-md.patch), not just the post-image files in _changed_md/, so
deletes are legitimate review targets.
Two fixes that go together:
1. Derive has_md_changes from diff-md.patch (the unfiltered git diff
already computed) instead of changed-md.txt. diff-md.patch includes
D entries; changed-md.txt does not.
2. Add a defensive `mkdir -p _changed_md` after artifact download.
actions/upload-artifact silently omits empty directories — on a
deletion-only PR the artifact carries no _changed_md/ at all, and
Pass 1's `working-directory: _changed_md` would fail. The
directory is recreated empty; Pass 1 still operates on the diff.
🤖 Generated by [robots](https://vyos.io)
| -rw-r--r-- | .github/workflows/ai-validation.yml | 17 |
1 files changed, 16 insertions, 1 deletions
diff --git a/.github/workflows/ai-validation.yml b/.github/workflows/ai-validation.yml index 5319023e..f75081dc 100644 --- a/.github/workflows/ai-validation.yml +++ b/.github/workflows/ai-validation.yml @@ -133,7 +133,12 @@ jobs: git show "HEAD:$path" > "_changed_md/$path" done < changed-md.z - if [ -s changed-md.txt ]; then + # Use diff-md.patch (unfiltered git diff) rather than changed-md.txt + # (--diff-filter=ACMRT) so deletion-only PRs still trigger validate. + # Pass 1 reviews the diff, not just the post-image files in + # _changed_md/, so deletes are legitimate review targets even though + # they produce no entries in _changed_md/. + if [ -s diff-md.patch ]; then echo "has_md_changes=true" >> "$GITHUB_OUTPUT" else echo "has_md_changes=false" >> "$GITHUB_OUTPUT" @@ -208,6 +213,16 @@ jobs: with: name: pr-input + - name: Ensure _changed_md exists (handles deletion-only PRs) + if: steps.secrets-check.outputs.skip != 'true' + # actions/upload-artifact silently omits empty directories. On a + # deletion-only PR, prepare's _changed_md/ holds no files and never + # makes it across the artifact boundary — Pass 1's + # working-directory: _changed_md would then fail. Recreate the + # directory unconditionally; Pass 1 still operates on the diff + # via --pr-diff ../diff-md.patch, which is the source of truth. + run: mkdir -p _changed_md + - name: Generate GitHub App token if: steps.secrets-check.outputs.skip != 'true' id: app |
