From 2868a31181e5dcfa4e01859ddb6be358771cd75f Mon Sep 17 00:00:00 2001 From: JoseD Marques Date: Tue, 8 Nov 2022 20:09:16 +0000 Subject: [PATCH] feat: replace cp with node implementation --- action/dist/index.js | 8 +++----- action/src/index.ts | 10 ++++------ 2 files changed, 7 insertions(+), 11 deletions(-) diff --git a/action/dist/index.js b/action/dist/index.js index d453fdc..964bf28 100644 --- a/action/dist/index.js +++ b/action/dist/index.js @@ -12305,11 +12305,9 @@ const main = async ({ env = process.env, log, }) => { // Make sure the destination folder exists await (0, io_1.mkdirP)(path.resolve(REPO_TEMP, destinationFolder)); log.log(`##[info] Copying all files from ${folder}`); - // TODO: replace this copy with a node implementation - await (0, exports.exec)(`cp -rT "${folder}"/ ${destinationFolder}`, { - log, - env: childEnv, - cwd: REPO_TEMP, + await (0, io_1.cp)(`${folder}/`, `${REPO_TEMP}/${destinationFolder}/`, { + recursive: true, + copySourceDirectory: false, }); await (0, exports.exec)(`git add -A .`, { log, env: childEnv, cwd: REPO_TEMP }); const message = config.message diff --git a/action/src/index.ts b/action/src/index.ts index de95f11..b1a6471 100644 --- a/action/src/index.ts +++ b/action/src/index.ts @@ -5,7 +5,7 @@ import gitUrlParse from 'git-url-parse'; import { homedir, tmpdir } from 'os'; import * as path from 'path'; import git from 'isomorphic-git'; -import { mkdirP } from '@actions/io'; +import { mkdirP, cp } from '@actions/io'; export type Console = { readonly log: (...msg: unknown[]) => void; @@ -579,11 +579,9 @@ export const main = async ({ await mkdirP(path.resolve(REPO_TEMP, destinationFolder)); log.log(`##[info] Copying all files from ${folder}`); - // TODO: replace this copy with a node implementation - await exec(`cp -rT "${folder}"/ ${destinationFolder}`, { - log, - env: childEnv, - cwd: REPO_TEMP, + await cp(`${folder}/`, `${REPO_TEMP}/${destinationFolder}/`, { + recursive: true, + copySourceDirectory: false, }); await exec(`git add -A .`, { log, env: childEnv, cwd: REPO_TEMP }); const message = config.message