Skip to content

Commit

Permalink
🐛 Add trailing slash to destination directories
Browse files Browse the repository at this point in the history
  • Loading branch information
BetaHuhn committed Dec 22, 2021
1 parent 6a0df96 commit eb3a718
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
7 changes: 5 additions & 2 deletions src/helpers.js
Original file line number Diff line number Diff line change
Expand Up @@ -85,11 +85,14 @@ 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 }`)
const filePath = path.join(dest, file)
core.debug(`Found a orphaned file in the target repo - ${ filePath }`)

if (exclude !== undefined && exclude.includes(path.join(src, file))) {
core.debug(`Excluding file ${ file }`)
} else {
await fs.remove(`${ dest }${ file }`)
core.debug(`Removing file ${ file }`)
await fs.remove(filePath)
}
}
}
Expand Down
5 changes: 3 additions & 2 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -67,14 +67,15 @@ const run = async () => {

const isDirectory = await pathIsDirectory(file.source)
const source = isDirectory ? `${ addTrailingSlash(file.source) }` : file.source
const dest = isDirectory ? `${ addTrailingSlash(file.dest) }` : file.dest

if (isDirectory) core.info(`Source is directory`)

const deleteOrphaned = isDirectory && file.deleteOrphaned

await copy(source, localDestination, deleteOrphaned, file.exclude)
await copy(source, dest, deleteOrphaned, file.exclude)

await git.add(file.dest)
await git.add(dest)

// Commit each file separately, if option is set to false commit all files at once later
if (COMMIT_EACH_FILE === true) {
Expand Down

0 comments on commit eb3a718

Please sign in to comment.