From f0b40ec80f6811e12b26b0b6f453da39bbca4636 Mon Sep 17 00:00:00 2001 From: Sean McGinnis Date: Thu, 4 Feb 2021 10:09:17 -0600 Subject: [PATCH] Add --overwrite flag to tar extraction There are times when previous actions have already extracted at least some files to the cache location. This results in subsequent cache extraction operations to emit errors such as: > /usr/bin/tar: [dest_file_path]: Cannot open: File exists This adds the --overwrite flag to the extract call to force tar to just overwrite these files rather than reporting errors. Signed-off-by: Sean McGinnis --- dist/post_run/index.js | 4 +++- dist/run/index.js | 4 +++- src/install.ts | 4 +++- 3 files changed, 9 insertions(+), 3 deletions(-) diff --git a/dist/post_run/index.js b/dist/post_run/index.js index 78a1f20..e5c8bf9 100644 --- a/dist/post_run/index.js +++ b/dist/post_run/index.js @@ -48580,7 +48580,9 @@ function installLint(versionConfig) { repl = /\.zip$/; } else { - extractedDir = yield tc.extractTar(archivePath, process.env.HOME); + // We want to always overwrite files if the local cache already has them + let args = ['xz', '--overwrite']; + extractedDir = yield tc.extractTar(archivePath, process.env.HOME, args); } const urlParts = assetURL.split(`/`); const dirName = urlParts[urlParts.length - 1].replace(repl, ``); diff --git a/dist/run/index.js b/dist/run/index.js index 2562a9b..95c9890 100644 --- a/dist/run/index.js +++ b/dist/run/index.js @@ -48590,7 +48590,9 @@ function installLint(versionConfig) { repl = /\.zip$/; } else { - extractedDir = yield tc.extractTar(archivePath, process.env.HOME); + // We want to always overwrite files if the local cache already has them + let args = ['xz', '--overwrite']; + extractedDir = yield tc.extractTar(archivePath, process.env.HOME, args); } const urlParts = assetURL.split(`/`); const dirName = urlParts[urlParts.length - 1].replace(repl, ``); diff --git a/src/install.ts b/src/install.ts index 218c595..dad6c4d 100644 --- a/src/install.ts +++ b/src/install.ts @@ -45,7 +45,9 @@ export async function installLint(versionConfig: VersionConfig): Promise extractedDir = await tc.extractZip(archivePath, process.env.HOME) repl = /\.zip$/ } else { - extractedDir = await tc.extractTar(archivePath, process.env.HOME) + // We want to always overwrite files if the local cache already has them + let args = ['xz', '--overwrite'] + extractedDir = await tc.extractTar(archivePath, process.env.HOME, args) } const urlParts = assetURL.split(`/`)