From 5e2f6ab327ed24d6ea66ed91e0d6506524778230 Mon Sep 17 00:00:00 2001 From: Yuriy Andamasov Date: Mon, 11 May 2026 01:25:48 +0300 Subject: ci(ai-validation): cover deletion-only Markdown PRs MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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) --- .github/workflows/ai-validation.yml | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) 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 -- cgit v1.2.3