changelog init: add --mode and --workflows flags for onboarding paths - #4152
theletterf wants to merge 2 commits into
Conversation
Extends `docs-builder changelog init` with two new flags: - `--mode <gh-release|changelog-auto|changelog-manual>`: selects the changelog.yml template and whether to include a release trigger. gh-release uses a new minimal template (bundle section only, no pivot or rules). changelog-auto and changelog-manual use the full template. Omitting --mode preserves the existing default behaviour. - `--workflows`: generates the three release-notes-*.yml GitHub Actions caller files under .github/workflows/. Skips any file that already exists. Emits a warning for gh-release and changelog-auto modes that bundle-on-release: true requires a non-GITHUB_TOKEN release publisher. Also warns when existing *.yaml files are found in the changelog directory (TopDirectoryOnly scanning means they will be uploaded on the first push to main). Closes #4151 Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Docs preview (local build)Handbook preview: https://docs-v3-preview.elastic.dev/elastic/docs-builder/pull/4152/ |
There was a problem hiding this comment.
Requesting changes based on the inline findings.
What is this? | From workflow: PR Review
Give us feedback! React with 🚀 if perfect, 👍 if helpful, 👎 if not.
| var useNonDefaultBundlesDir = bundlesDir != null; | ||
| var repoRoot = Paths.FindGitRoot(docsFolder)?.FullName ?? docsFolder.FullName; | ||
|
|
||
| var isGhRelease = string.Equals(mode, "gh-release", StringComparison.OrdinalIgnoreCase); |
There was a problem hiding this comment.
Severity: MEDIUM
--mode is documented as an explicit 3-value choice, but the implementation treats it as an unconstrained string and only checks gh-release/changelog-auto. Any typo silently falls back to manual behavior and exits 0.
Example: --mode changelog-auot succeeds, creates the full/manual template, and gives no validation error.
Please validate mode against {gh-release, changelog-auto, changelog-manual} (or model it as an enum) and return a non-zero argument error for unknown values.
| if (workflows) | ||
| { | ||
| var configRelPath = GetPathForConfig(repoRoot, configPath).Trim('"'); | ||
| var workflowsDir = _fileSystem.Path.Join(repoRoot, ".github", "workflows"); |
There was a problem hiding this comment.
Severity: HIGH
--workflows currently writes into .github/workflows, but this command uses ChangelogFileSystem where hidden dirs are restricted to .git and .artifacts. In practice this throws ScopedFileSystemException (Access denied: path must not traverse hidden directories) when WriteWorkflowFile runs, so changelog init --workflows crashes instead of completing onboarding.
Concrete repro from this branch:
dotnet run --project src/tooling/docs-builder -- changelog init --path tmp-changelog-review-repro --workflows --mode changelog-auto
Please either allow .github in the changelog FS scope for this operation, or use a filesystem path that can legally write workflow files, and handle scoped-FS exceptions as normal command errors.
Closes #4151
What
Extends
docs-builder changelog initwith--modeand--workflowsflags to support all three onboarding paths without manual workflow file creation.Changes
--mode gh-release|changelog-auto|changelog-manual: selects the template and release triggergh-releaseuses a new minimalchangelog.example-gh-release.yml(bundle section only, nopivot:orrules:)changelog-autoandchangelog-manualuse the existing full template--modepreserves the current default behaviour exactly--workflows: generates the threerelease-notes-*.ymlcaller files under.github/workflows/. Skips files that already exist (warns instead of overwriting).*.yamlfiles exist there (TopDirectoryOnly scanning means they will be uploaded on first push to main).gh-releaseandchangelog-automodes —bundle-on-release: trueonly fires when the release is published by a non-GITHUB_TOKEN.Notes
--mode null(default) preserves current behaviour exactly🤖 Generated with Claude Code