@@ -16,6 +16,7 @@ const defaults = {
1616 override : false ,
1717 ignoreLabels : false ,
1818 ignoreIssuesWith : false ,
19+ ignoreCommitsWith : false ,
1920 groupBy : false ,
2021 milestoneMatch : 'Release {{tag_name}}'
2122} ;
@@ -29,11 +30,21 @@ class Gren {
2930 this . options = ObjectAssign ( { } , defaults , props ) ;
3031 this . tasks = [ ] ;
3132
32- const { username, repo, token, apiUrl, tags, ignoreLabels, ignoreIssuesWith } = this . options ;
33+ const {
34+ username,
35+ repo,
36+ token,
37+ apiUrl,
38+ tags,
39+ ignoreLabels,
40+ ignoreIssuesWith,
41+ ignoreCommitsWith
42+ } = this . options ;
3343
3444 this . options . tags = utils . convertStringToArray ( tags ) ;
3545 this . options . ignoreLabels = utils . convertStringToArray ( ignoreLabels ) ;
3646 this . options . ignoreIssuesWith = utils . convertStringToArray ( ignoreIssuesWith ) ;
47+ this . options . ignoreCommitsWith = utils . convertStringToArray ( ignoreCommitsWith ) ;
3748 this . options . limit = this . options . tags . indexOf ( 'all' ) >= 0 ? MAX_TAGS_LIMIT : TAGS_LIMIT ;
3849
3950 if ( ! token ) {
@@ -540,22 +551,20 @@ class Gren {
540551 _filterCommit ( { commit : { message } } ) {
541552 const messageType = this . options . includeMessages ;
542553 const filterMap = {
543- merges : function ( message ) {
544- return message . match ( / ^ m e r g e / i) ;
545- } ,
546- commits : function ( message ) {
547- return ! message . match ( / ^ m e r g e / i) ;
548- } ,
549- all : function ( ) {
550- return true ;
551- }
554+ merges : message => message . match ( / ^ m e r g e / i) ,
555+ commits : message => ! message . match ( / ^ m e r g e / i) ,
556+ all : ( ) => true
552557 } ;
558+ const shouldIgnoreMessage = this . options . ignoreCommitsWith . every ( commitMessage => {
559+ const regex = new RegExp ( commitMessage , 'i' ) ;
560+ return ! message . split ( '\n' ) [ 0 ] . match ( regex ) ;
561+ } ) ;
553562
554563 if ( filterMap [ messageType ] ) {
555- return filterMap [ messageType ] ( message ) ;
564+ return filterMap [ messageType ] ( message ) && shouldIgnoreMessage ;
556565 }
557566
558- return filterMap . commits ( message ) ;
567+ return filterMap . commits ( message ) && shouldIgnoreMessage ;
559568 }
560569
561570 /**
0 commit comments