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 <sean.mcginnis@gmail.com>
This commit is contained in:
Sean McGinnis 2021-02-04 10:09:17 -06:00
parent 125ac487c1
commit f0b40ec80f
No known key found for this signature in database
GPG key ID: CE7EE4BFAF8D70C8
3 changed files with 9 additions and 3 deletions

View file

@ -48580,7 +48580,9 @@ function installLint(versionConfig) {
repl = /\.zip$/; repl = /\.zip$/;
} }
else { 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 urlParts = assetURL.split(`/`);
const dirName = urlParts[urlParts.length - 1].replace(repl, ``); const dirName = urlParts[urlParts.length - 1].replace(repl, ``);

4
dist/run/index.js vendored
View file

@ -48590,7 +48590,9 @@ function installLint(versionConfig) {
repl = /\.zip$/; repl = /\.zip$/;
} }
else { 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 urlParts = assetURL.split(`/`);
const dirName = urlParts[urlParts.length - 1].replace(repl, ``); const dirName = urlParts[urlParts.length - 1].replace(repl, ``);

View file

@ -45,7 +45,9 @@ export async function installLint(versionConfig: VersionConfig): Promise<string>
extractedDir = await tc.extractZip(archivePath, process.env.HOME) extractedDir = await tc.extractZip(archivePath, process.env.HOME)
repl = /\.zip$/ repl = /\.zip$/
} else { } 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(`/`) const urlParts = assetURL.split(`/`)