fix: Use path.resolve for inps.PublishDir not path.join

This commit is contained in:
peaceiris 2020-10-20 17:17:38 +09:00
parent f8d2ed3863
commit f06738911c
No known key found for this signature in database
GPG Key ID: 5868468A8EBA64EC

View File

@ -43,7 +43,7 @@ export async function copyAssets(
const dotGitPath = path.join(publishDir, '.git'); const dotGitPath = path.join(publishDir, '.git');
if (fs.existsSync(dotGitPath)) { if (fs.existsSync(dotGitPath)) {
core.info(`[INFO] delete .git`); core.info(`[INFO] delete ${dotGitPath}`);
io.rmRF(dotGitPath); io.rmRF(dotGitPath);
} }
@ -57,8 +57,8 @@ export async function copyAssets(
export async function setRepo(inps: Inputs, remoteURL: string, workDir: string): Promise<void> { export async function setRepo(inps: Inputs, remoteURL: string, workDir: string): Promise<void> {
const publishDir = path.isAbsolute(inps.PublishDir) const publishDir = path.isAbsolute(inps.PublishDir)
? inps.PublishDir ? path.resolve(inps.PublishDir)
: path.join(`${process.env.GITHUB_WORKSPACE}`, inps.PublishDir); : path.resolve(`${process.env.GITHUB_WORKSPACE}`, inps.PublishDir);
if (path.isAbsolute(inps.DestinationDir)) { if (path.isAbsolute(inps.DestinationDir)) {
throw new Error('destination_dir should be a relative path'); throw new Error('destination_dir should be a relative path');