feat: support custom section mapping via SEMREL_PLUGIN_SECTIONS_JSON#39
Open
mwaldheim wants to merge 2 commits into
Open
feat: support custom section mapping via SEMREL_PLUGIN_SECTIONS_JSON#39mwaldheim wants to merge 2 commits into
mwaldheim wants to merge 2 commits into
Conversation
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>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Brings
generator-release-notesin line with the section-mapping feature added togenerator-changelog-md(see SemRels/generator-changelog-md#47, which implements generator-changelog-md#46) andgenerator-changelog-html(SemRels/generator-changelog-html#38).Adds an optional
type->sectionmapping for release-note generation, mirroring thepresetConfig.typesoption of@semantic-release/release-notes-generator.Changes
internal/plugin/generator.go: newSectionRule{Type, Section, Hidden}type andGenerateOptions.Sections.classifyCommitnow takesGenerateOptionsand uses the configured mapping when present instead of the built-in feat/fix defaults.hidden: truedrops 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 newSEMREL_PLUGIN_SECTIONS_JSONenv 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 newSEMREL_PLUGIN_SECTIONS_JSONproperty.generator_test.goandmain_test.gocovering custom sections, case-insensitive type matching, and invalid JSON handling.Example config
All tests,
go vetand the build pass locally.