Skip to content

Commit f5a92d2

Browse files
authored
ci: changelogs to detect breaking change commits (#282)
1 parent e3c0fee commit f5a92d2

File tree

1 file changed

+13
-4
lines changed

1 file changed

+13
-4
lines changed

scripts/changelog/generate.mjs

+13-4
Original file line numberDiff line numberDiff line change
@@ -43,10 +43,19 @@ export function generateChangelog(pkg, preset) {
4343
path: pkg.gitPath ?? pkg.path,
4444
};
4545

46-
const changelogStream = conventionalChangelog(options, context, gitRawCommitsOpts).on('error', (error) => {
47-
console.error(error.stack);
48-
process.exit(1);
49-
});
46+
// detect breaking change headers: https://github.com/conventional-changelog/conventional-changelog/issues/648#issuecomment-704867077
47+
const parserOptions = {
48+
headerPattern: /^(\w*)(?:\((.*)\))?!?: (.*)$/,
49+
breakingHeaderPattern: /^(\w*)(?:\((.*)\))?!: (.*)$/,
50+
};
51+
52+
const changelogStream = conventionalChangelog(options, context, gitRawCommitsOpts, parserOptions).on(
53+
'error',
54+
(error) => {
55+
console.error(error.stack);
56+
process.exit(1);
57+
},
58+
);
5059

5160
const CHANGELOG_FILE = pkg.changelogPath;
5261

0 commit comments

Comments
 (0)