Add --report option for changelog add command#3227
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Enterprise Run ID: 📒 Files selected for processing (2)
🚧 Files skipped from review as they are similar to previous changes (2)
📝 WalkthroughWalkthroughAdds a new Sequence DiagramsequenceDiagram
actor User
participant CLI as ChangelogCommand
participant Parser as PromotionReportParser
participant FS as FileSystem
participant HTTP as HTTPFetcher
participant GitHub as GitHubService
participant Service as ChangelogCreationService
User->>CLI: run `changelog add --report <path|url>`
CLI->>Parser: ParseReportToPrUrlsAsync(report)
alt local file
Parser->>FS: read HTML file
else http(s) URL
Parser->>HTTP: fetch HTML
HTTP-->>Parser: HTML content
end
Parser-->>CLI: list of PR URLs
loop per PR URL
CLI->>GitHub: FetchPrInfoAsync(prNumber)
GitHub-->>CLI: PR metadata (title, url, etc.)
end
CLI->>Service: CreateChangelog with parsed PRs
Service->>Service: generate YAML per PR
Service->>FS: write <prNumber>.yaml files
FS-->>User: changelog YAML files created
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches✨ Simplify code
Warning Review ran into problems🔥 ProblemsGit: Failed to clone repository. Please run the Tip 💬 Introducing Slack Agent: The best way for teams to turn conversations into code.Slack Agent is built on CodeRabbit's deep understanding of your code, so your team can collaborate across the entire SDLC without losing context.
Built for teams:
One agent for your entire SDLC. Right inside Slack. Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Review rate limit: 0/1 reviews remaining, refill in 60 minutes.Comment |
There was a problem hiding this comment.
Actionable comments posted: 2
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@docs/cli/changelog/add.md`:
- Around line 86-90: The docs for the CLI flag `--report` only mention
`https://` but the command accepts both `http://` and `https://`; update the
`--report <string?>` description and the sentence about network access/host
restrictions (and the reference to `changelog bundle --report`) to explicitly
state that both http:// and https:// report URLs are accepted, and clarify that
network access is required and only allowed hosts (e.g., github.com,
buildkite.com) are supported for either scheme.
In `@tests/Elastic.Changelog.Tests/Changelogs/Create/AddReportOptionTests.cs`:
- Around line 91-94: The test only asserts the first generated changelog (yaml1)
so add a second read/assert for the second file (e.g., read files[1] into a new
variable like yaml2 using FileSystem.File.ReadAllTextAsync with
TestContext.Current.CancellationToken) and assert that yaml2 contains the
expected title and PR link for the second changelog (for example "title: Second
from report" and "https://github.com/elastic/elasticsearch/pull/7002") to fully
cover the --report path; use the same FluentAssertions style as
yaml1.Should().Contain(...) so the new assertions mirror the existing checks.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Enterprise
Run ID: 681b3164-f00c-46aa-92a8-34e375eafb6f
📒 Files selected for processing (3)
docs/cli/changelog/add.mdsrc/tooling/docs-builder/Commands/ChangelogCommand.cstests/Elastic.Changelog.Tests/Changelogs/Create/AddReportOptionTests.cs
…nTests.cs Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
Co-authored-by: Cursor <cursoragent@cursor.com> # Conflicts: # docs/cli/changelog/add.md
* Add --report option for changelog add command * Update tests/Elastic.Changelog.Tests/Changelogs/Create/AddReportOptionTests.cs Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com> --------- Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com> Co-authored-by: Felipe Cotti <felipe.cotti@elastic.co>
This PR updates the "docs-builder changelog add" command to support a "--report" option that matches what exists in the "changelog bundle" command.
This serves as a stop-gap for teams that are not yet generating their changelogs on a PR-by-PR basis--they can be generated as needed at the time of the release instead.
AI implementation details
CLI (
changelog add --report)In
src/tooling/docs-builder/Commands/ChangelogCommand.cs:--report: resolves promotion HTML (URL or normalized file path) viaPromotionReportParser.ParseReportToPrUrlsAsync, then runs the normalChangelogCreationServicepath with the resulting PR URLs (same idea as--prs).--prs,--issues, and--release-version(with explicit error messages).NormalizePath;https:///http://sources are passed through unchanged (same pattern as elsewhere).--use-pr-numbervalidation now allows--reportas a source of PRs; XML docs updated for--strip-title-prefix, title/type requirements, and related options.Tests
New file
tests/Elastic.Changelog.Tests/Changelogs/Create/AddReportOptionTests.cs:--use-pr-number.dotnet test tests/Elastic.Changelog.Tests/passes (including these tests).Documentation
docs/cli/changelog/add.mdnow documents--report, mutual exclusivity, parity withchangelog bundle --report, host/network notes, and an example that runschangelog add --reportthenchangelog bundle --reportwith the same file.Generative AI disclosure
Tool(s) and model(s) used: composer-2, claude-4-sonnet-thinking