fix: KeepFiles behaviour when DestinationDir has dir (#405)

Related to #324
This commit is contained in:
Shohei Ueda 2020-07-21 12:53:14 +09:00 committed by GitHub
parent 3874723ac6
commit ce4e3beff1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 16 additions and 4 deletions

View File

@ -73,12 +73,24 @@ export async function setRepo(inps: Inputs, remoteURL: string, workDir: string):
options
);
if (result.exitcode === 0) {
process.chdir(workDir);
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 {
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);
return;