Skip to content

Drop release-body parsing; use GitHub commit-range and generate-notes for PRs - #4092

Merged
Mpdreamz merged 6 commits into
mainfrom
feat/changelog-gh-release-commit-range
Sep 15, 2026
Merged

Mpdreamz merged 6 commits into
mainfrom
feat/changelog-gh-release-commit-range

Conversation

@Mpdreamz

@Mpdreamz Mpdreamz commented Sep 15, 2026

Copy link
Copy Markdown
Member

Fixes the tagged-workflow bundle failure on repos with an empty release body by replacing two unreliable approaches with the GitHub APIs that own those answers.

Affects: Changelog pipeline, GitHub Actions integration

Prompt summary: The tagged workflow on elastic/docs-playground-release-notes-tagged failed because the release body was empty — the old code tried to parse PR references out of the body markdown. The user asked to remove all body-parsing logic entirely and use only the GitHub API's own PR list and commit-range API as the source of truth, with verbose per-PR decision output. A follow-up improvement uses POST /releases/generate-notes to find the previous tag instead of fetching the last N releases and scanning.

Why

ReleaseNoteParser.Parse("") returned format=Unknown with 0 PRs, causing an early return with no changelogs. Body format varies across repos and tools — relying on it is fragile. The GitHub compare API ({prevTag}..{currentTag}) already returns the authoritative PR list; it needs no body. The previous-tag discovery fetched the last 10 releases and scanned with SkipWhile, which breaks for multi-version repos where releases are interleaved across major versions.

What

Release-body parsing removed

ReleaseNoteParser is no longer called from any production path. GitHubReleaseChangelogService and ProfileFilterResolver now call IGitHubCommitRangeService.ResolvePullRequestsAsync directly to get the PR list from the commit range between the previous and current tags.

Previous-tag discovery via generate-notes

IGitHubReleaseService.FetchPreviousTagAsync calls POST /repos/{owner}/{repo}/releases/generate-notes with {"tag_name": "<currentTag>"}. GitHub returns previous_tag_name using its own algorithm, which handles interleaved multi-version releases correctly. No side effects — the endpoint only generates content.

Verbose per-PR decision logging

Each PR from the commit range is logged with its inclusion or exclusion reason (matched label block rule, label-derived type, pool entry used, or PR info unavailable).

CLI schema updated

warn-on-type-mismatch flag removed from docs/cli-schema.json after the corresponding code was deleted.

Verify

dotnet test tests/Elastic.Changelog.Tests/

Replace all ReleaseNoteParser / release-body parsing in the gh-release
and profile github_release flows with IGitHubCommitRangeService. The
GitHub compare API is the authoritative source of PRs for a release;
the release body text was fragile (empty bodies, varying formats) and
has been removed entirely. Each PR decision is now logged explicitly:
why it was included or excluded.

Update GhReleaseExtractionParityTests, ReleaseVersionTests,
BundleProfileGitHubReleaseTests, and BundleCdnSourcingTests to mock
FetchReleasesAsync and ResolvePullRequestsAsync instead of body text.

Co-Authored-By: Claude <noreply@anthropic.com>
@Mpdreamz
Mpdreamz requested a review from a team as a code owner September 15, 2026 10:10
@Mpdreamz Mpdreamz added the bug label Sep 15, 2026
@Mpdreamz
Mpdreamz requested a review from akira28 September 15, 2026 10:10
@Mpdreamz Mpdreamz added the bug label Sep 15, 2026
@github-actions

Copy link
Copy Markdown

Docs preview (local build)

Handbook preview: https://docs-v3-preview.elastic.dev/elastic/docs-builder/pull/4092/

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Requesting changes: the new commit-range flow can fail for valid older release tags because predecessor lookup is limited to the latest 10 releases.


What is this? | From workflow: PR Review

Give us feedback! React with 🚀 if perfect, 👍 if helpful, 👎 if not.

Comment thread src/services/Elastic.Changelog/GithubRelease/GitHubReleaseChangelogService.cs Outdated
Co-Authored-By: Claude <noreply@anthropic.com>
Replaces the FetchReleasesAsync + SkipWhile approach with a POST to
/repos/{owner}/{repo}/releases/generate-notes, which returns
previous_tag_name directly from GitHub's own algorithm. This handles
multi-version repos correctly — GitHub picks the right predecessor even
when releases are interleaved across major versions.

Co-Authored-By: Claude <noreply@anthropic.com>
@Mpdreamz Mpdreamz changed the title Drop release-body parsing; resolve gh-release PRs via GitHub commit-range API Drop release-body parsing; use GitHub commit-range and generate-notes for PRs Sep 15, 2026

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Requesting changes: previous-tag resolution in the --release-version path should not rely on a fixed 10-release window.


What is this? | From workflow: PR Review

Give us feedback! React with 🚀 if perfect, 👍 if helpful, 👎 if not.

Comment thread src/tooling/docs-builder/Commands/ChangelogCommand.cs Outdated
The bundle --release-version and remove --release-version flows in
ChangelogCommand.cs still used the 10-release FetchReleasesAsync +
SkipWhile pattern. Switch them to FetchPreviousTagAsync so all call
sites use the generate-notes endpoint consistently.

Co-Authored-By: Claude <noreply@anthropic.com>

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Requesting changes based on the inline findings.


What is this? | From workflow: PR Review

Give us feedback! React with 🚀 if perfect, 👍 if helpful, 👎 if not.

Comment thread src/tooling/docs-builder/Commands/ChangelogCommand.cs Outdated
Comment thread src/services/Elastic.Changelog/GitHub/GitHubReleaseService.cs Outdated
Use a typed DTO serialized via the AOT JSON context for the generate-notes
request body instead of raw string interpolation, so tag names with special
characters are always encoded correctly.

Split resolution==null (API/credential failure → error, return 1) from
resolution.PullRequests.Count==0 (valid empty range → warning, return 0)
in the bundle and remove --release-version flows so real failures are not
silently swallowed as no-ops.

Co-Authored-By: Claude <noreply@anthropic.com>

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Requesting changes based on the inline findings.


What is this? | From workflow: PR Review

Give us feedback! React with 🚀 if perfect, 👍 if helpful, 👎 if not.

Comment thread src/services/Elastic.Changelog/Bundling/ProfileFilterResolver.cs
Comment thread src/services/Elastic.Changelog/Bundling/ProfileFilterResolver.cs Outdated
…leFilterResolver

ChangelogRemoveService now accepts IGitHubCommitRangeService and passes it
to ProfileFilterResolver.ResolveAsync, so source: github_release profiles
work in changelog remove instead of failing with a null-service error.

ProfileFilterResolver now distinguishes resolution==null (API/credential
failure → error) from PullRequests.Count==0 (valid empty range → warning)
so failures are not masked as no-op warnings.

Co-Authored-By: Claude <noreply@anthropic.com>

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Approving — no new actionable issues found in the latest changes.


What is this? | From workflow: PR Review

Give us feedback! React with 🚀 if perfect, 👍 if helpful, 👎 if not.

@Mpdreamz
Mpdreamz merged commit d003c85 into main Sep 15, 2026
32 checks passed
@Mpdreamz
Mpdreamz deleted the feat/changelog-gh-release-commit-range branch September 15, 2026 11:57
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