Skip to content

feat(core,github-action,github): support custom changelog preamble#187

Open
dangreen wants to merge 1 commit into
mainfrom
feat/changelog-preamble
Open

feat(core,github-action,github): support custom changelog preamble#187
dangreen wants to merge 1 commit into
mainfrom
feat/changelog-preamble

Conversation

@dangreen

Copy link
Copy Markdown
Member

Adds support for a custom changelog preamble — arbitrary markdown inserted into the changelog right after the version header, before the generated sections.

Usage

Config / JS API — a new bump.preamble option; per package in a monorepo via bump.byProject[name].preamble.

Pull request comment!simple-release/set-preamble followed by the markdown. In a monorepo, pass the full package name (in backticks so GitHub keeps it as text) to target one package:

!simple-release/set-preamble `@your-org/core`

## Core changes

- New plugin system

Multiple per-package comments coexist (newest per package wins); one comment without a name sets a global preamble for the whole release. The command honors the same owner/member/collaborator restriction as set-options.

Notes

  • Non-breaking. Rendering reuses the existing preamblePartialProject.bump just started populating the changelog context's preamble. Per-package targeting reuses bump.byProject (keyed by full package name).
  • The GitHub Action itself needs no code change; the feature ships when the action bumps its @simple-release/github-action dependency.
  • Tests: core rendering (global + per-package), the comment parser (name / backticks / empty / untrusted author), and suppression of the "Version bump without any changes." fallback when a preamble is set.

Inject custom markdown into the changelog after the version header via a new
bump.preamble option (config or JS API), or a !simple-release/set-preamble
pull request comment — globally or per package through byProject.
@coveralls

Copy link
Copy Markdown

Coverage Report for CI Build 29292523859

Coverage decreased (-0.9%) to 62.199%

Details

  • Coverage decreased (-0.9%) from the base build.
  • Patch coverage: 38 uncovered changes across 2 files (12 of 50 lines covered, 24.0%).
  • No coverage regressions found.

Uncovered Changes

File Changed Covered %
packages/github-action/src/releaser.ts 37 0 0.0%
packages/github-action/src/conditions.ts 1 0 0.0%
Total (3 files) 50 12 24.0%

Coverage Regressions

No coverage regressions found.


Coverage Stats

Coverage Status
Relevant Lines: 1041
Covered Lines: 708
Line Coverage: 68.01%
Relevant Branches: 578
Covered Branches: 299
Branch Coverage: 51.73%
Branches in Coverage %: Yes
Coverage Strength: 10.73 hits per line

💛 - Coveralls

Copilot AI 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.

Pull request overview

Adds end-to-end support for a user-defined changelog “preamble” (markdown inserted immediately after the version header), configurable via JS/config (bump.preamble, bump.byProject[name].preamble) and via a new PR comment command (!simple-release/set-preamble).

Changes:

  • Extend core bump options and changelog template context to carry a preamble, and suppress the “Version bump without any changes.” fallback when a preamble exists.
  • Add GitHub Action support for parsing !simple-release/set-preamble comments (global + per-package) and applying them to bump options.
  • Update docs/cheatsheet and add tests for preamble rendering and comment parsing.

Reviewed changes

Copilot reviewed 14 out of 14 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
website/src/content/docs/js-api/releaser.mdx Documents new bump.preamble option (and monorepo usage).
website/src/content/docs/github-action/release-automation.mdx Documents !simple-release/set-preamble usage for PR comments.
skills/setup-simple-release-action/SKILL.md Updates setup guidance to mention the new comment command.
packages/github/src/cheatsheet.ts Adds cheatsheet section for set-preamble and updates restrictions/notes wording.
packages/github-action/src/releaser.ts Scans PR comments for preambles and merges them into bump options.
packages/github-action/src/conditions.ts Triggers comment-driven runs for both set-options and set-preamble.
packages/github-action/src/comment.ts Adds set-preamble command parsing and exports COMMANDS.
packages/github-action/src/comment.spec.ts Adds vitest coverage for set-preamble parsing behavior.
packages/core/src/project/project.types.ts Adds preamble?: string to ProjectBumpOptions.
packages/core/src/project/project.ts Passes preamble into changelog template context.
packages/core/src/project/packageJsonMonorepo.spec.ts Tests global vs per-project preamble behavior in monorepos.
packages/core/src/project/packageJson.spec.ts Tests insertion position and placeholder suppression for preamble.
packages/core/src/project/monorepo.types.ts Allows preamble in byProject bump options typing.
packages/core/src/change-log.ts Suppresses “no changes” placeholder when a preamble exists.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +64 to +68
const preamble = newlineIndex === -1
? ''
: body.slice(newlineIndex + 1).trim()

if (preamble) {
| `prerelease` | Pre-release identifier for prerelease bumps. |
| `snapshot` | Pre-release identifier with a timestamp suffix for [snapshot builds](/github-action/snapshot-release/). Always applied when set. |
| `skipChangelog` | Update versions without generating the changelog. |
| `preamble` | Custom markdown inserted into the changelog after the version header, before the generated sections. In a monorepo it applies to every package; set it per package with `byProject`. |
* comment event but not a command comment, or `null` when it is not a comment
* event at all.
*/
export function ifSetOptionsComment() {
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants