2222const ErrorStash = require ( './errorStash' )
2323const MergeDeep = require ( '../mergeDeep' )
2424const NopCommand = require ( '../nopcommand' )
25+ const Glob = require ( '../glob' )
2526const ignorableFields = [ 'id' , 'node_id' , 'default' , 'url' ]
2627module . exports = class Diffable extends ErrorStash {
2728 constructor ( nop , github , repo , entries , log , errors ) {
@@ -39,7 +40,10 @@ module.exports = class Diffable extends ErrorStash {
3940 // this.log.debug(` entries ${JSON.stringify(filteredEntries)}`)
4041 filteredEntries = filteredEntries . filter ( attrs => {
4142 if ( Array . isArray ( attrs . exclude ) ) {
42- if ( ! attrs . exclude . includes ( this . repo . repo ) ) {
43+ const excludeGlobs = attrs . exclude . map ( exc => new Glob ( exc ) ) ;
44+ const excludeGlobsMatch = excludeGlobs . some ( glob => ! ! this . repo . repo . match ( glob ) ) ;
45+
46+ if ( ! attrs . exclude . includes ( this . repo . repo ) && ! excludeGlobsMatch ) {
4347 // this.log.debug(`returning not excluded entry = ${JSON.stringify(attrs)} for repo ${this.repo.repo}`)
4448 return true
4549 } else {
@@ -53,7 +57,10 @@ module.exports = class Diffable extends ErrorStash {
5357 } )
5458 filteredEntries = filteredEntries . filter ( attrs => {
5559 if ( Array . isArray ( attrs . include ) ) {
56- if ( attrs . include . includes ( this . repo . repo ) ) {
60+ const includeGlobs = attrs . include . map ( inc => new Glob ( inc ) ) ;
61+ const includeGlobsMatch = includeGlobs . some ( glob => ! ! this . repo . repo . match ( glob ) ) ;
62+
63+ if ( attrs . include . includes ( this . repo . repo ) || includeGlobsMatch ) {
5764 // this.log.debug(`returning included entry = ${JSON.stringify(attrs)} for repo ${this.repo.repo}`)
5865 return true
5966 } else {
0 commit comments