Add --use-pr-number to changelog add command #2422
Open
+96
−5
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.
Background
The
docs-builder changelog addcommand currently outputs files that follow the naming structure using by Elastic Agent: https://github.com/elastic/elastic-agent/tree/main/changelog/fragmentsHowever, Elasticsearch changelogs currently use a different format (i.e. the filenames match the PR numbers): https://github.com/elastic/elasticsearch/tree/main/docs/changelog
It seems reasonable for the tool to accommodate either option.
Summary
--use-pr-numberoption to thedocs-builder changelog addcommand.Changes Made
ChangelogInput.cs: AddedUsePrNumberproperty to track when the option is enabled.ChangelogCommand.cs:--use-pr-numberparameter (boolean, defaults to false)ChangelogInputChangelogService.cs:--pris provided when--use-pr-numberis usedExtractPrNumber()helper to extract PR numbers from:https://github.com/owner/repo/pull/123owner/repo#123123(when--ownerand--repoare provided){prNumber}.yamlwhen--use-pr-numberis set, instead of{timestamp}-{slug}.yamldocs/contribute/changelog.md:--use-pr-numberto the command options list{timestamp}-{sanitized-title}.yaml) and how to use--use-pr-numberto create filenames like{pr-number}.yamldocs/cli/release/changelog-add.md:--use-pr-numberoption documentation in the Options section--prmust be provided when using this optionUsage
This command creates a file named
767653383-esql-fix-extent-reading-when-missing.yaml:This command creates a file named
140034.yaml:Here are more examples:
The implementation includes validation and error handling. The build completed successfully, and the help output shows the new option.
Generative AI disclosure
Tool(s) and model(s) used: composer-1 agent