Skip to content

Fix changelog add and gh-release commands to follow repo, owner, and dir precedence pattern#2854

Merged
lcawl merged 3 commits intofeat/changelog-bundle-release-versionfrom
feat/changelog-github-cleanup
Mar 5, 2026
Merged

Fix changelog add and gh-release commands to follow repo, owner, and dir precedence pattern#2854
lcawl merged 3 commits intofeat/changelog-bundle-release-versionfrom
feat/changelog-github-cleanup

Conversation

@lcawl
Copy link
Contributor

@lcawl lcawl commented Mar 5, 2026

Summary

While testing #2843 I found some more areas for improvement.
In particular, the changelog gh-release and changelog add weren't aligning with the way the "changelog bundle" and "remove" commands are now resolving repo, owner, and changelog directory details from the changelog config file.

Details

Fix: hang in changelog add --release-version (Step 1)

In ChangelogCommand.Create, added the StartAsync/WaitForDrain/StopAsync drain triplet before each of the three early return 1 statements inside the --release-version block (the --prs mutual exclusivity check, the --issues mutual exclusivity check, and the missing --repo check). This matches the pattern used everywhere else in the file and prevents ServiceInvoker.DisposeAsync from hanging on an unstarted collector.

Feature: config fallbacks for changelog add --release-version

Before validating --repo, the command now loads changelog.yml and applies the same precedence chain used by changelog bundle and changelog remove:

  • --repo CLI > bundle.repo in changelog.yml
  • --owner CLI > bundle.owner in changelog.yml > "elastic"
  • --output CLI > bundle.directory in changelog.yml > ./changelogs (service default)

The error message for a missing repo now reads: "--release-version requires --repo to be specified (or bundle.repo set in changelog.yml)."

Feature: config fallback for changelog gh-release

--output CLI > bundle.directory in changelog.yml > ./changelogs (service default).

Tests

  • Added 3 tests to ChangelogConfigurationTests.cs verifying that bundle.repo/bundle.owner/bundle.directory are correctly parsed from config, that a missing bundle section returns null, and that a missing config file returns ChangelogConfiguration.Default with a null Bundle.
  • Added 1 test to ReleaseVersionTests.cs verifying that when Output = null is passed to GitHubReleaseChangelogService, it defaults to ./changelogs relative to the current directory.

Docs

  • changelog-add.md: Updated --output, --owner, --repo, and --release-version option descriptions to document the config fallbacks.
  • changelog-gh-release.md: Updated --output description and added a short example showing the command can be run without --output when bundle.directory is set.
  • contribute/changelog.md: Updated all three --release-version sections and the gh-release section to document the config fallbacks and show the minimal invocation example.

Feature: config fallback for changelog add

ChangelogCommand.Create in ChangelogCommand.cs:

  • Config loading and fallback resolution (resolvedRepo, resolvedOwner, resolvedOutput) are now done once, before the if (releaseVersion != null) split, rather than only inside that block.
  • The --release-version block now uses the already-resolved values.
  • The CreateChangelogArguments construction (non-release-version path) now uses resolvedOwner, resolvedRepo, and resolvedOutput instead of the raw CLI values.

changelog-add.md:

  • --output: "When used with --release-version" qualifier removed; it now simply says "Falls back to bundle.directory…".
  • --owner and --repo: Same — the qualifiers have been dropped.

contribute/changelog.md:

  • Added a general note to the opening of the "Create changelog files" section explaining that the bundle.* fallbacks apply to all changelog add modes.
  • Updated the --release-version subsections to say "This applies to all changelog add modes" instead of implying it's a --release-version-only feature.
Scenario Old behavior New behavior
--prs 123 --repo elasticsearch (no --owner) Validator fails: "both --owner and --repo must be provided" resolvedOwner = bundle.owner ?? "elastic" → works
--prs 123 with bundle.repo in config Validator fails: repo missing resolvedRepo = bundle.repo → works
Any mode, no --output, bundle.directory set File lands in CWD File lands in bundle.directory
Full URLs (--prs https://...) Owner/repo unused, no difference Same — owner/repo ignored when URL is full

Generative AI disclosure

  1. Did you use a generative AI (GenAI) tool to assist in creating this contribution?
  • Yes
  • No
  1. If you answered "Yes" to the previous question, please specify the tool(s) and model(s) used (e.g., Google Gemini, OpenAI ChatGPT-4, etc.).

Tool(s) and model(s) used: composer-1.5, clause-4.6-sonnet-medium

@lcawl lcawl added the bug label Mar 5, 2026
@lcawl lcawl marked this pull request as ready for review March 5, 2026 04:15
@lcawl lcawl requested review from a team as code owners March 5, 2026 04:15
@lcawl lcawl requested a review from reakaleek March 5, 2026 04:15
@lcawl lcawl merged commit 58b20f4 into feat/changelog-bundle-release-version Mar 5, 2026
25 checks passed
@lcawl lcawl deleted the feat/changelog-github-cleanup branch March 5, 2026 04:28
cotti pushed a commit that referenced this pull request Mar 5, 2026
…flow (#2843)

* Enhance changelog add command with github release workflow

* Enhance changelog bundle command with github release workflow

* Enhance changelog remove command with github release workflow (#2844)

* Fix changelog add and gh-release commands to follow repo, owner, and dir precedence pattern (#2854)

* Remove duplicate content

* More docs clarity

* More docs cleanup
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.

1 participant