Skip to content

changelog init: add --mode and --workflows flags for onboarding paths - #4152

Open
theletterf wants to merge 2 commits into
mainfrom
feat/changelog-init-modes
Open

theletterf wants to merge 2 commits into
mainfrom
feat/changelog-init-modes

Conversation

@theletterf

Copy link
Copy Markdown
Member

Closes #4151

What

Extends docs-builder changelog init with --mode and --workflows flags to support all three onboarding paths without manual workflow file creation.

Changes

  • --mode gh-release|changelog-auto|changelog-manual: selects the template and release trigger
    • gh-release uses a new minimal changelog.example-gh-release.yml (bundle section only, no pivot: or rules:)
    • changelog-auto and changelog-manual use the existing full template
    • Omitting --mode preserves the current default behaviour exactly
  • --workflows: generates the three release-notes-*.yml caller files under .github/workflows/. Skips files that already exist (warns instead of overwriting).
  • Fixture warning: after creating the changelog directory, warns if any *.yaml files exist there (TopDirectoryOnly scanning means they will be uploaded on first push to main).
  • GITHUB_TOKEN warning: emitted for gh-release and changelog-auto modes — bundle-on-release: true only fires when the release is published by a non-GITHUB_TOKEN.

Notes

  • Interactive TTY prompting deferred to a follow-up
  • --mode null (default) preserves current behaviour exactly

🤖 Generated with Claude Code

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>
@github-actions

Copy link
Copy Markdown
Contributor

Docs preview (local build)

Handbook preview: https://docs-v3-preview.elastic.dev/elastic/docs-builder/pull/4152/

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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");

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

changelog init: support all three onboarding paths and optionally scaffold workflow files

1 participant