Skip to content

Commit

Permalink
fix: KeepFiles behaviour when DestinationDir has dir (#405)
Browse files Browse the repository at this point in the history
Related to #324
  • Loading branch information
peaceiris authored Jul 21, 2020
1 parent 3874723 commit ce4e3be
Showing 1 changed file with 16 additions and 4 deletions.
20 changes: 16 additions & 4 deletions src/git-utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -73,11 +73,23 @@ export async function setRepo(inps: Inputs, remoteURL: string, workDir: string):
options
);
if (result.exitcode === 0) {
process.chdir(workDir);
if (inps.KeepFiles) {
core.info('[INFO] Keep existing files');
await createDir(destDir);
process.chdir(destDir);

if (inps.DestinationDir !== '') {
if (inps.KeepFiles) {
core.info('[INFO] Keep existing files');
} else {
core.info(`[INFO] clean up ${destDir}`);
await exec.exec('git', ['rm', '-r', '--ignore-unmatch', '*']);
}
} else {
await exec.exec('git', ['rm', '-r', '--ignore-unmatch', '*']);
if (inps.KeepFiles) {
core.info('[INFO] Keep existing files');
} else {
core.info(`[INFO] clean up ${destDir}`);
await exec.exec('git', ['rm', '-r', '--ignore-unmatch', '*']);
}
}

await copyAssets(publishDir, destDir);
Expand Down

0 comments on commit ce4e3be

Please sign in to comment.