Skip to content

Post blanket comment when only snippets or CSV files change - #238

Merged
theletterf merged 1 commit into
mainfrom
snippet-preview-fallback-comment
Jul 22, 2026
Merged

Post blanket comment when only snippets or CSV files change#238
theletterf merged 1 commit into
mainfrom
snippet-preview-fallback-comment

Conversation

@theletterf

Copy link
Copy Markdown
Member

Why

When a PR edits only _snippets/ or .csv files, changedMdFiles is empty and the comment step returned silently — leaving contributors with no preview entry point. Kuni reported this exact case today in #docs.

The previous fix attempt (docs-builder#3220) added a list-dependents subcommand to walk the reverse include graph. The team agreed a simpler blanket comment is sufficient and less complex (Martijn's review, thread in #docs).

What

In the "Comment on PR" step, when changedMdFiles is empty:

  • If no snippet or CSV files changed either → still return silently (no docs touched)
  • If only snippets/CSVs changed → post a fallback comment under the same ## 🔍 Preview links for changed docs title, linking to the preview index

The fallback comment deduplicates correctly on re-runs (same title lookup). PRs that mix page and snippet changes are unaffected — they fall through to the existing per-page link logic.

Test plan

  • Open a PR in a docs repo that only edits _snippets/ files → preview comment should appear with the index link
  • Open a PR that edits both a page and a snippet → preview comment should show per-page links as before
  • Open a PR with no .md changes → no comment posted

🤖 Generated with Claude Code

When a PR edits only _snippets/ or .csv files, changedMdFiles is empty
and the comment step returned silently, leaving contributors with no
preview entry point.

Now: detect that case and post a fallback comment under the same title
(so it deduplicates correctly on re-runs) linking to the preview index.
PRs that mix page and snippet changes are unaffected.

Closes: elastic/docs-builder#3220

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@theletterf
theletterf merged commit 87e105b into main Jul 22, 2026
4 of 5 checks passed
@theletterf
theletterf deleted the snippet-preview-fallback-comment branch July 22, 2026 10:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants