Skip to content

Commit aea9533

Browse files
committed
Merge branch 'main-enterprise' of https://github.com/avelizmu/safe-settings into decyjphr/pr-622
2 parents e7043c2 + bf68214 commit aea9533

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

lib/plugins/diffable.js

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222
const ErrorStash = require('./errorStash')
2323
const MergeDeep = require('../mergeDeep')
2424
const NopCommand = require('../nopcommand')
25+
const Glob = require('../glob')
2526
const ignorableFields = ['id', 'node_id', 'default', 'url']
2627
module.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

Comments
 (0)