Update docsbuilder changelog add to handle PR fetch failures #2407
+285
−74
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.
While testing the
docs-builder changelog addcommand and attempting to pull PR information from a private repo, the command failed to fetch and did not generate a changelog even when I provided the minimal --title and --type. Better handling is required for situations where the fetch fails.Summary
docs-builder changelog addcommand to generate a basic changelog even when PR fetch fails.Behavior
--prsis provided and PR fetch fails:--titleand--typeif providedExamples
docs-builder changelog add --title "test title" --type enhancement --products cloud-hosted --prs 149106 --owner elastic --repo cloudOriginally this type of command failed to create a changelog and reported this error:
Error: Failed to fetch PR information from GitHub for PR: 149106. Skipping this PR.Now the command successfully creates a changelog with this warning:
Warning: Failed to fetch PR information from GitHub for PR: 149106. Generating basic changelog with provided values.If you omit the
--titleoption, for example, you'll get another warning like this:Warning: Title is missing. The changelog will be created with title commented out. Please manually update the title field.Changes
CreateSingleChangelogmethod:prFetchFailedto adjust validation behaviorCreateChangelogsForMultiplePrsmethod:BuildChangelogDatamethod:GenerateYamlmethod:cloud-serverlessproduct to test configurationCreateSingleChangelogCreateSingleChangelogfor consistencyTests
CreateChangelog_WithPrOptionButPrFetchFails_WithTitleAndType_CreatesChangelog--titleand--typeare provided, a changelog is created using those values.CreateChangelog_WithPrOptionButPrFetchFails_WithoutTitleAndType_CreatesChangelogWithCommentedFields--titleor--typeare not provided, a changelog is created with commented title/type fields and warnings are emitted.CreateChangelog_WithMultiplePrsButPrFetchFails_GeneratesBasicChangelogsThe tests verify that:
Outstanding work
I think there is likely a need for a way to supply GitHub tokens or other credentials necessary to access private repos.
Generative AI disclosure
Tool(s) and model(s) used: composer-1 agent