Skip to content

Commit e8fedb4

Browse files
committed
added an includePatterns
1 parent 91f356e commit e8fedb4

File tree

2 files changed

+16
-0
lines changed

2 files changed

+16
-0
lines changed

src/config.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -196,6 +196,7 @@ const parseFiles = (files) => {
196196
replace: item.replace === undefined ? REPLACE_DEFAULT : item.replace,
197197
deleteOrphaned: item.deleteOrphaned === undefined ? DELETE_ORPHANED_DEFAULT : item.deleteOrphaned,
198198
excludeFilePatterns: item.excludeFilePatterns === undefined ? [] : item.excludeFilePatterns,
199+
includeFilePatterns: item.includeFilePatterns === undefined ? [] : item.includeFilePatterns,
199200
exclude: parseExclude(item.exclude, item.source)
200201
}
201202
}

src/helpers.js

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -137,6 +137,21 @@ export async function copy(src, dest, isDirectory, file) {
137137
}
138138
}
139139

140+
// Check if the file matches any of the includeFilePatterns
141+
if (file.includeFilePatterns.length > 0) {
142+
let matches = false
143+
for (const pattern of file.includeFilePatterns) {
144+
if (srcFile.match(pattern)) {
145+
matches = true
146+
break
147+
}
148+
}
149+
150+
if (!matches) {
151+
core.debug(`Excluding file ${ srcFile } since it does not match any of the includeFilePatterns.`)
152+
return false
153+
}
154+
}
140155
return true
141156
}
142157

0 commit comments

Comments
 (0)