Add file support to docs-builder changelog add --prs option #2453
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Summary
docs-builder changelog add --prsoption, allowing users to specify pull requests either as comma-separated values or via a file containing newline-delimited PR URLs or numbers.This implementation matches the behavior of the
docs-builder changelog bundle --prsoption (per #2411 ), providing consistency across changelog commands.Example
./build.sh clean ./build.sh publishbinaries cd .artifacts/publish/docs-builder/release/The command completes with the following message:
This is an expected error, since the pull request had the
>non-issuelabel. The rest of the changelogs were created successfully.Changes Made
1. Command Implementation (
src/tooling/docs-builder/Commands/ChangelogCommand.cs)What Changed:
System.IO.Abstractionsusing statement for file system operations_fileSystemfield to theChangelogCommandclass--prsparameterKey Implementation Details:
--prsarray is a file path (by checking if the file exists)--prsarguments can be specified, mixing file paths and comma-separated values2. Documentation (
docs/cli/release/changelog-add.mdanddocs/contribute/changelog.md)What Changed:
--prsoption description to match the bundle command documentation3. Test Coverage (
tests/Elastic.Documentation.Services.Tests/ChangelogServiceTests.cs)What Changed:
CreateChangelog_WithPrsFromFile_ProcessesAllPrsFromFileCreateChangelog_WithMixedPrsFromFileAndCommaSeparated_ProcessesAllPrsTest 1:
CreateChangelog_WithPrsFromFile_ProcessesAllPrsFromFileTest 2:
CreateChangelog_WithMixedPrsFromFileAndCommaSeparated_ProcessesAllPrsBehavior
File Path Detection
--prsis a file path by callingFile.Exists()File Format
Multiple
--prsArguments--prsmultiple timesError Handling
Compatibility
This change is backward compatible:
Usage Examples
Example 1: Using a file
Example 2: Mixing file and comma-separated
Example 3: Multiple files
docs-builder changelog add \ --prs prs1.txt \ --prs prs2.txt \ --products "elasticsearch 9.2.0 ga"Testing
All tests pass successfully:
CreateChangelog_WithPrsFromFile_ProcessesAllPrsFromFileCreateChangelog_WithMixedPrsFromFileAndCommaSeparated_ProcessesAllPrsVerification
Generative AI disclosure
Tool(s) and model(s) used: composer-1 agent