Skip to content

Commit

Permalink
🐛 Check if exclude exists before using it (#114)
Browse files Browse the repository at this point in the history
  • Loading branch information
thomasLeclaire committed Sep 23, 2021
1 parent 543886c commit 0abefcc
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/helpers.js
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ const copy = async (src, dest, deleteOrphaned, exclude) => {

const filterFunc = (file) => {

if (exclude.includes(file)) {
if (exclude !== undefined && exclude.includes(file)) {
core.debug(`Excluding file ${ file }`)
return false
}
Expand All @@ -86,7 +86,7 @@ const copy = async (src, dest, deleteOrphaned, exclude) => {
for (const file of destFileList) {
if (srcFileList.indexOf(file) === -1) {
core.debug(`Found a orphaned file in the target repo - ${ dest }${ file }`)
if (exclude.includes(path.join(src, file))) {
if (exclude !== undefined && exclude.includes(path.join(src, file))) {
core.debug(`Excluding file ${ file }`)
} else {
await fs.remove(`${ dest }${ file }`)
Expand Down

0 comments on commit 0abefcc

Please sign in to comment.