Skip to content

[ci] Add blocking PR check for package docs using docs-builder#17879

Merged
theletterf merged 6 commits intomainfrom
ci/validate-package-docs
Mar 25, 2026
Merged

[ci] Add blocking PR check for package docs using docs-builder#17879
theletterf merged 6 commits intomainfrom
ci/validate-package-docs

Conversation

@theletterf
Copy link
Copy Markdown
Member

Summary

  • Adds .github/workflows/validate-package-docs.yml — a new blocking PR check that runs elastic/docs-builder (metadata-only + strict mode) against any packages/**/docs/*.md files changed in a PR
  • Generates a temporary docset.yml at the repo root listing only the changed files, so no static manifest needs to be maintained
  • Excludes _dev/build/ paths (those contain {{ fields }} template syntax not valid for docs-builder)
  • Exits early if no package docs changed, so unrelated PRs pay zero cost

Why

Vale linting already runs but is non-blocking (fail_on_error: false). Badly formatted Markdown or invalid docs-builder directives can slip into packages/*/docs/README.md files and break downstream consumers (EPR / integration-docs repo) silently. This check catches those issues at PR time.

Test plan

  • Open a PR modifying a packages/*/docs/README.md with intentionally broken Markdown — confirm Validate Package Docs (docs-builder) check appears and fails
  • Fix the Markdown — confirm the check passes
  • Open a PR touching only non-docs files — confirm the check is skipped

🤖 Generated with Claude Code

Adds a new workflow that validates changed packages/**/docs/*.md files
on every PR using the elastic/docs-builder action (metadata-only + strict
mode), catching Elastic-specific syntax issues before they reach EPR/downstream.

_dev/build/ template files are excluded since they contain {{ fields }}
syntax that is not valid docs-builder input.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@theletterf theletterf requested a review from a team as a code owner March 18, 2026 13:51
@theletterf theletterf marked this pull request as draft March 18, 2026 13:54
@theletterf theletterf self-assigned this Mar 18, 2026
@theletterf theletterf added the Team:Docs Label for the Observability docs team label Mar 18, 2026
@theletterf
Copy link
Copy Markdown
Member Author

+CC @elastic/docs-engineering @elastic/integration-docs

@theletterf theletterf marked this pull request as ready for review March 18, 2026 16:07
Comment thread .github/workflows/validate-package-docs.yml Outdated
Narrows the path trigger from packages/**/docs/** to packages/**/docs/*.md
and tightens the grep filter to [^/]*.md$ so only top-level docs files
are validated, excluding knowledge_base/ and other subdirectories.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@theletterf
Copy link
Copy Markdown
Member Author

Good catch — fixed in the latest commit. Both the path trigger and the grep filter now exclude subdirectories under docs/: the trigger uses packages/**/docs/*.md (single-level * instead of **) and the grep uses [^/]*\.md$ to reject any path with a slash after docs/, so knowledge_base/ and similar subdirs are ignored.

@theletterf theletterf requested a review from mjwolf March 19, 2026 07:51
@theletterf
Copy link
Copy Markdown
Member Author

@elastic/ecosystem Please have a look, thanks!

@theletterf
Copy link
Copy Markdown
Member Author

@elastic/ecosystem Could you have a look / approve?

Copy link
Copy Markdown
Collaborator

@mrodm mrodm left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM.

Just wondering if the filtering could be updated to be able to detect those other level of packages.
It could be done also in a follow-up.

id: changed-docs
run: |
FILES=$(git diff --name-only origin/${{ github.base_ref }}...HEAD \
| grep '^packages/.*/docs/[^/]*\.md$' \
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This would be needed to be updated once this issue is done: #17403

Once that issue is completed, there could be packages at different levels. There is an example in this PoC #16966

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good heads-up! Both the path trigger (packages/**/docs/*.md) and the grep filter (^packages/.*/docs/[^/]*\.md$) already handle nested package paths like packages/nginx/nginx/docs/README.md, so this should work without changes once #17403 lands.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@mrodm Keep me honest here though! :)

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actually I was wrong — packages/**/docs/*.md doesn't match nested paths. Fixed in the latest commit: now uses two explicit patterns (packages/*/docs/*.md and packages/*/*/docs/*.md) so both current and nested package structures (per #17403) are covered. The grep filter was already fine since .* in regex has no depth limit.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!
Checking again this regex and I think it works as it should, once it is added the other level of directories:

 $ echo packages/nginx/nginx_otel/docs/README.md |  grep '^packages/.*/docs/[^/]*\.md$'
packages/nginx/nginx_otel/docs/README.md

Replace packages/**/docs/*.md with explicit single- and two-level
patterns so the workflow also triggers for nested packages like
packages/nginx/nginx/docs/README.md (see #17403).

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Copy link
Copy Markdown
Collaborator

@mrodm mrodm left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

@theletterf theletterf merged commit 09cba3b into main Mar 25, 2026
11 checks passed
@theletterf theletterf deleted the ci/validate-package-docs branch March 25, 2026 09:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Team:Docs Label for the Observability docs team

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants