Skip to content

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

Description

@theletterf

`docs-builder changelog init` currently scaffolds a generic `changelog.yml` and the changelog directory. It doesn't account for the three distinct ways teams use the feature, and it never touches workflow files — leaving onboarding incomplete without manual steps.

Three paths

Mode Per-PR entries Automated bundle Workflow trigger
`gh-release` No Yes (from GitHub release notes) `on: release` or inline jobs
`changelog-auto` Yes Yes (at release time) `on: release` or inline jobs
`changelog-manual` Yes No (manual `changelog bundle`) push + PR only

Proposed changes

1. Mode selection

Accept `--mode <gh-release|changelog-auto|changelog-manual>`. When omitted and stdin is a TTY, prompt interactively:

```
? How are release notes generated?

From GitHub release notes at publish time (gh-release)
Per-PR changelog entries, bundled automatically at release (changelog-auto)
Per-PR changelog entries, bundled manually (changelog-manual)
```

2. Path-appropriate `changelog.yml` skeleton

  • `gh-release`: emit only the `bundle:` section. Omit `pivot:`, `rules:`, and `profiles:` — unused by this path.
  • `changelog-auto` / `changelog-manual`: full skeleton with `pivot.types` (placeholders for `feature`, `bug-fix`, `breaking-change`), `rules.create.exclude`, and `rules.bundle.exclude_types: "other"` (required: release-drafter headers for Maintenance/Chore/Automation/CI/Redesign all map to `other` in the parser).

3. Optional workflow file generation (`--workflows` flag or prompted)

Write the three callers under `.github/workflows/`:

  • `release-notes.yml`
  • `release-notes-comments.yml`
  • `release-notes-changelog-file.yml`

`gh-release` and `changelog-auto`: add `on: release: [published]` and `bundle-on-release: true`. Also emit a warning:

```
⚠ bundle-on-release: true only fires when the release is published by a human or a
non-GITHUB_TOKEN. If your release workflow uses `github.token`, add the bundle jobs
inline instead.
```

`changelog-manual`: `release-notes.yml` gets only `pull_request` and `push` triggers.

Do not overwrite existing workflow files; skip with a warning if present.

4. Fixture entry warning

After writing the changelog directory, scan for existing `*.yaml` files. If found:

```
⚠ Found N existing .yaml files in docs/changelog/.
Only files directly in this directory are uploaded (TopDirectoryOnly).
Move demo/sample/fixture entries to docs/changelog/examples/ before the first push to main.
```

Out of scope

  • Detecting the release token type automatically (not reliably possible from the repo alone).
  • Modifying the release workflow to add inline bundle jobs (covered by the warning above).
  • Writing `release-notes-backfill.yml` (follow-up).

Acceptance criteria

  • `--mode gh-release` produces a minimal `changelog.yml` with no `pivot:` or `rules:`.
  • `--mode changelog-auto --workflows` writes all three workflow files and prints the GITHUB_TOKEN warning.
  • `--mode changelog-manual --workflows` writes workflow files with no `release:` trigger.
  • Running without `--mode` on a TTY prompts for the path.
  • Existing files are never silently overwritten.
  • Fixture warning fires when `*.yaml` files are found in the target directory.

Activity

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

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions