Skip to content

Add git-diff exporter for CI changed-pages.json - #3895

Draft
reakaleek wants to merge 7 commits into
mainfrom
cursor/git-diff-exporter
Draft

reakaleek wants to merge 7 commits into
mainfrom
cursor/git-diff-exporter

Conversation

@reakaleek

Copy link
Copy Markdown
Member

Why

  • Preview comment jobs guess page URLs from GitHub changed-file paths. Those URLs do not match navigation URLs, path prefixes, or pages that include changed snippets.
  • CI needs a builder-produced list of published page URLs and titles.

What

  • Add an opt-in gitdiff exporter that writes changed-pages.json during isolated builds.
  • Map git changes (or GitHub Actions file lists) onto built pages and include reverse-index entries.
  • Auto-enable the exporter on CI isolated builds.

Notes

  • Merge the matching elastic/docs-actions PR before preview comments use the new artifact.
  • Git failures are soft. The build writes an empty pages array and logs a warning.

Made with Cursor

Preview comments need builder URLs, not guessed paths from GitHub file lists.
new(comparer)[...] is invalid C#. Pass the collection and comparer as separate constructor arguments.
Cover GetChanges, CI file lists, and include mapping without a real .git folder.
dotnet format --verify-no-changes treats a non-static local function as a lint failure.
The page was linked from index.md but not listed in _docset.yml, so --strict CI failed.
Named branches often do not exist in local clones or shallow checkouts. The first parent still gives a usable diff.
dotnet format --verify-no-changes treats new[] as IDE0300.

@Mpdreamz Mpdreamz left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

One blocker before this is ready: GitChangedFileSource.ResolveDiffBase returns origin/<GITHUB_BASE_REF> immediately without checking that the ref exists. On pull_request CI with a shallow merge checkout, GITHUB_BASE_REF is set but origin/main is not necessarily present, so git diff origin/main HEAD can fail and the exporter will write an empty changed-pages.json instead of falling back to HEAD^1. The docs and tests say named bases fall back when missing, but that path is skipped for GITHUB_BASE_REF. Please verify the GitHub base ref before returning it, or make the diff step fall back when that ref is unusable.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants