Install actions/artifact@v1 as artifact-legacy and v2 as artifact

This commit is contained in:
Angela P Wen
2024-09-25 12:06:16 -07:00
parent 46e0c78da9
commit 76b799de1d
5370 changed files with 2176476 additions and 71812 deletions
+27 -23
View File
@@ -14,7 +14,6 @@ const os = require('os');
const path = require('path');
const crypto = require('crypto');
const _c = { fs: fs.constants, os: os.constants };
const rimraf = require('rimraf');
/*
* The working inner variables.
@@ -43,12 +42,32 @@ const
_removeObjects = [],
// API change in fs.rmdirSync leads to error when passing in a second parameter, e.g. the callback
FN_RMDIR_SYNC = fs.rmdirSync.bind(fs),
FN_RIMRAF_SYNC = rimraf.sync;
FN_RMDIR_SYNC = fs.rmdirSync.bind(fs);
let
_gracefulCleanup = false;
/**
* Recursively remove a directory and its contents.
*
* @param {string} dirPath path of directory to remove
* @param {Function} callback
* @private
*/
function rimraf(dirPath, callback) {
return fs.rm(dirPath, { recursive: true }, callback);
}
/**
* Recursively remove a directory and its contents, synchronously.
*
* @param {string} dirPath path of directory to remove
* @private
*/
function FN_RIMRAF_SYNC(dirPath) {
return fs.rmSync(dirPath, { recursive: true });
}
/**
* Gets a temporary file name.
*
@@ -535,7 +554,7 @@ function _assertAndSanitizeOptions(options) {
options.template = _isBlank(options.template) ? undefined : path.relative(options.dir, options.template);
// for completeness' sake only, also keep (multiple) blanks if the user, purportedly sane, requests us to
options.name = _isUndefined(options.name) ? undefined : _sanitizeName(options.name);
options.name = _isUndefined(options.name) ? undefined : options.name;
options.prefix = _isUndefined(options.prefix) ? '' : options.prefix;
options.postfix = _isUndefined(options.postfix) ? '' : options.postfix;
}
@@ -552,28 +571,13 @@ function _assertAndSanitizeOptions(options) {
* @private
*/
function _resolvePath(name, tmpDir) {
const sanitizedName = _sanitizeName(name);
if (sanitizedName.startsWith(tmpDir)) {
return path.resolve(sanitizedName);
if (name.startsWith(tmpDir)) {
return path.resolve(name);
} else {
return path.resolve(path.join(tmpDir, sanitizedName));
return path.resolve(path.join(tmpDir, name));
}
}
/**
* Sanitize the specified path name by removing all quote characters.
*
* @param name
* @returns {string}
* @private
*/
function _sanitizeName(name) {
if (_isBlank(name)) {
return name;
}
return name.replace(/["']/g, '');
}
/**
* Asserts whether specified name is relative to the specified tmpDir.
*
@@ -663,7 +667,7 @@ function setGracefulCleanup() {
* @returns {string} the currently configured tmp dir
*/
function _getTmpDir(options) {
return path.resolve(_sanitizeName(options && options.tmpdir || os.tmpdir()));
return path.resolve(options && options.tmpdir || os.tmpdir());
}
// Install process exit listener