Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

header Pattern cannot be overridden from the config #1293

Open
Gabicad opened this issue Jul 11, 2024 · 2 comments
Open

header Pattern cannot be overridden from the config #1293

Gabicad opened this issue Jul 11, 2024 · 2 comments

Comments

@Gabicad
Copy link

Gabicad commented Jul 11, 2024

This is very annoying while I want to introduce my own pattern.
Suggested solution :

return { headerPattern: /^(\w*)(?:\((.*)\))?!?: (.*)$/, breakingHeaderPattern: /^(\w*)(?:\((.*)\))?!: (.*)$/, headerCorrespondence: [ 'type', 'scope', 'subject' ], noteKeywords: ['BREAKING CHANGE', 'BREAKING-CHANGE'], revertPattern: /^(?:Revert|revert:)\s"?([\s\S]+?)"?\s*This reverts commit (\w*)\./i, revertCorrespondence: ['header', 'hash'], ...config }

@jaklan
Copy link

jaklan commented Dec 1, 2024

We have a similar problem, but not with headerPattern, but with breakingHeaderPattern. We are using conventional-changelog-conventionalcommits with @semantic-release/release-notes-generator, which fortunately allows to overwrite parserOpts, but we cannot overwrite breakingHeaderPattern, because it's hardcoded here:

export const breakingHeaderPattern = /^(\w*)(?:\((.*)\))?!: (.*)$/

@pvdlg @dangreen is there any chance to make it configurable or to overwrite it somehow during runtime (I'm not the specialist in JS monkeypatching 😉)?

Why do we need it? We use semantic-release in a repo with a few packages, and we differentiate commits by package name in a scope and the last piece we need to make it work is such a configuration:

        parserOpts: {
          noteKeywords: [],
          breakingHeaderPattern:
            /^(\w*)(?:\((package-a\/.*)\))?!: (.*)$/,
        },

which is unfortunately ignored in the addBangNotes() function.

@jaklan
Copy link

jaklan commented Dec 1, 2024

Also a follow-up issue in the semantic-release repo:
semantic-release/release-notes-generator#741

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

No branches or pull requests

2 participants