Skip to content

feat: support custom section mapping via SEMREL_PLUGIN_SECTIONS_JSON#39

Open
mwaldheim wants to merge 2 commits into
mainfrom
feature/section-mapping
Open

feat: support custom section mapping via SEMREL_PLUGIN_SECTIONS_JSON#39
mwaldheim wants to merge 2 commits into
mainfrom
feature/section-mapping

Conversation

@mwaldheim

Copy link
Copy Markdown
Contributor

Brings generator-release-notes in line with the section-mapping feature added to generator-changelog-md (see SemRels/generator-changelog-md#47, which implements generator-changelog-md#46) and generator-changelog-html (SemRels/generator-changelog-html#38).

Adds an optional type -> section mapping for release-note generation, mirroring the presetConfig.types option of @semantic-release/release-notes-generator.

Changes

  • internal/plugin/generator.go: new SectionRule{Type, Section, Hidden} type and GenerateOptions.Sections. classifyCommit now takes GenerateOptions and uses the configured mapping when present instead of the built-in feat/fix defaults. hidden: true drops matching commits entirely (e.g. docs/refactor). Types without a matching rule fall back to "Other". This plugin has no dedicated "Breaking Changes" section (breaking commits are prefixed with "BREAKING: " within their mapped section), so that behavior is preserved unchanged.
  • cmd/plugin/main.go: reads new SEMREL_PLUGIN_SECTIONS_JSON env var (JSON array). Invalid JSON is logged as a warning and ignored, consistent with this plugin's existing non-fatal handling of contributor JSON.
  • schema/v1.json: documents the new SEMREL_PLUGIN_SECTIONS_JSON property.
  • Tests added in generator_test.go and main_test.go covering custom sections, case-insensitive type matching, and invalid JSON handling.

Example config

- uses: generator-release-notes
  args:
    sections_json: '[{"type":"feat","section":"Features"},{"type":"fix","section":"Bugfixes"},{"type":"deps","section":"Dependencies"},{"type":"chore","section":"Miscellaneous"},{"type":"docs","hidden":true}]'

All tests, go vet and the build pass locally.

mwaldheim and others added 2 commits July 14, 2026 09:22
Adds an optional type->section mapping for release-note generation, similar
to the presetConfig.types option of @semantic-release/release-notes-generator.
Rules can rename the heading a conventional-commit type is grouped under,
or hide commits of that type entirely. Types without a matching rule fall
back to 'Other'.

Brings this plugin in line with generator-changelog-md (SemRels/generator-changelog-md#47)
and generator-changelog-html (SemRels/generator-changelog-html#38).

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
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.

1 participant