File tree Expand file tree Collapse file tree 1 file changed +9
-3
lines changed Expand file tree Collapse file tree 1 file changed +9
-3
lines changed Original file line number Diff line number Diff line change @@ -12,17 +12,23 @@ module.exports = {
1212 writerOpts : {
1313 transform ( commit ) {
1414 if ( ! commit ) return null
15+
16+ // Filter out merge commits by header
1517 if ( commit . header && typeof commit . header === 'string' ) {
1618 if ( commit . header . startsWith ( 'Merge pull request' ) ) return null
1719 if ( commit . header . startsWith ( 'Merge branch' ) ) return null
1820 }
1921
22+ // Return a shallow copy instead of mutating the provided object.
23+ // The conventional-changelog writer may provide frozen/immutable commits.
24+ const out = Object . assign ( { } , commit )
25+
2026 // shorten commit hash for nicer links (7 chars is common)
21- if ( commit . hash && typeof commit . hash === 'string' && commit . hash . length > 7 ) {
22- commit . hash = commit . hash . slice ( 0 , 7 )
27+ if ( out . hash && typeof out . hash === 'string' && out . hash . length > 7 ) {
28+ out . hash = out . hash . slice ( 0 , 7 )
2329 }
2430
25- return commit
31+ return out
2632 } ,
2733 } ,
2834 } ,
You can’t perform that action at this time.
0 commit comments