feat: support packageManager in package.json (#27)

This commit is contained in:
Dan Adajian 2023-10-25 08:13:22 -05:00 committed by GitHub
parent bd26ebd2c7
commit 6be87460e3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 181 additions and 128 deletions

View File

@ -34,3 +34,21 @@ jobs:
name: Verify Bun name: Verify Bun
run: | run: |
bun --version bun --version
setup-bun-from-package-json-version:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os:
- ubuntu-latest
- macos-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Setup package.json
run: |
echo "$(jq '. += {"packageManager": "bun@1.0.0"}' package.json)" > package.json
- name: Setup Bun
uses: ./
- name: Verify Bun
run: |
bun --version

BIN
bun.lockb

Binary file not shown.

270
dist/action.js generated vendored
View File

@ -1979,7 +1979,7 @@ var require_path_utils = __commonJS({
}; };
Object.defineProperty(exports, "__esModule", { value: true }); Object.defineProperty(exports, "__esModule", { value: true });
exports.toPlatformPath = exports.toWin32Path = exports.toPosixPath = void 0; exports.toPlatformPath = exports.toWin32Path = exports.toPosixPath = void 0;
var path = __importStar2(require("path")); var path2 = __importStar2(require("path"));
function toPosixPath(pth) { function toPosixPath(pth) {
return pth.replace(/[\\]/g, "/"); return pth.replace(/[\\]/g, "/");
} }
@ -1989,7 +1989,7 @@ var require_path_utils = __commonJS({
} }
exports.toWin32Path = toWin32Path; exports.toWin32Path = toWin32Path;
function toPlatformPath(pth) { function toPlatformPath(pth) {
return pth.replace(/[/\\]/g, path.sep); return pth.replace(/[/\\]/g, path2.sep);
} }
exports.toPlatformPath = toPlatformPath; exports.toPlatformPath = toPlatformPath;
} }
@ -2060,7 +2060,7 @@ var require_core = __commonJS({
var file_command_1 = require_file_command(); var file_command_1 = require_file_command();
var utils_1 = require_utils(); var utils_1 = require_utils();
var os = __importStar2(require("os")); var os = __importStar2(require("os"));
var path = __importStar2(require("path")); var path2 = __importStar2(require("path"));
var oidc_utils_1 = require_oidc_utils(); var oidc_utils_1 = require_oidc_utils();
var ExitCode; var ExitCode;
(function(ExitCode2) { (function(ExitCode2) {
@ -2088,7 +2088,7 @@ var require_core = __commonJS({
} else { } else {
command_1.issueCommand("add-path", {}, inputPath); command_1.issueCommand("add-path", {}, inputPath);
} }
process.env["PATH"] = `${inputPath}${path.delimiter}${process.env["PATH"]}`; process.env["PATH"] = `${inputPath}${path2.delimiter}${process.env["PATH"]}`;
} }
exports.addPath = addPath2; exports.addPath = addPath2;
function getInput2(name, options) { function getInput2(name, options) {
@ -2287,7 +2287,7 @@ var require_io_util = __commonJS({
Object.defineProperty(exports, "__esModule", { value: true }); Object.defineProperty(exports, "__esModule", { value: true });
exports.getCmdPath = exports.tryGetExecutablePath = exports.isRooted = exports.isDirectory = exports.exists = exports.READONLY = exports.UV_FS_O_EXLOCK = exports.IS_WINDOWS = exports.unlink = exports.symlink = exports.stat = exports.rmdir = exports.rm = exports.rename = exports.readlink = exports.readdir = exports.open = exports.mkdir = exports.lstat = exports.copyFile = exports.chmod = void 0; exports.getCmdPath = exports.tryGetExecutablePath = exports.isRooted = exports.isDirectory = exports.exists = exports.READONLY = exports.UV_FS_O_EXLOCK = exports.IS_WINDOWS = exports.unlink = exports.symlink = exports.stat = exports.rmdir = exports.rm = exports.rename = exports.readlink = exports.readdir = exports.open = exports.mkdir = exports.lstat = exports.copyFile = exports.chmod = void 0;
var fs = __importStar2(require("fs")); var fs = __importStar2(require("fs"));
var path = __importStar2(require("path")); var path2 = __importStar2(require("path"));
_a = fs.promises, exports.chmod = _a.chmod, exports.copyFile = _a.copyFile, exports.lstat = _a.lstat, exports.mkdir = _a.mkdir, exports.open = _a.open, exports.readdir = _a.readdir, exports.readlink = _a.readlink, exports.rename = _a.rename, exports.rm = _a.rm, exports.rmdir = _a.rmdir, exports.stat = _a.stat, exports.symlink = _a.symlink, exports.unlink = _a.unlink; _a = fs.promises, exports.chmod = _a.chmod, exports.copyFile = _a.copyFile, exports.lstat = _a.lstat, exports.mkdir = _a.mkdir, exports.open = _a.open, exports.readdir = _a.readdir, exports.readlink = _a.readlink, exports.rename = _a.rename, exports.rm = _a.rm, exports.rmdir = _a.rmdir, exports.stat = _a.stat, exports.symlink = _a.symlink, exports.unlink = _a.unlink;
exports.IS_WINDOWS = process.platform === "win32"; exports.IS_WINDOWS = process.platform === "win32";
exports.UV_FS_O_EXLOCK = 268435456; exports.UV_FS_O_EXLOCK = 268435456;
@ -2336,7 +2336,7 @@ var require_io_util = __commonJS({
} }
if (stats && stats.isFile()) { if (stats && stats.isFile()) {
if (exports.IS_WINDOWS) { if (exports.IS_WINDOWS) {
const upperExt = path.extname(filePath).toUpperCase(); const upperExt = path2.extname(filePath).toUpperCase();
if (extensions.some((validExt) => validExt.toUpperCase() === upperExt)) { if (extensions.some((validExt) => validExt.toUpperCase() === upperExt)) {
return filePath; return filePath;
} }
@ -2360,11 +2360,11 @@ var require_io_util = __commonJS({
if (stats && stats.isFile()) { if (stats && stats.isFile()) {
if (exports.IS_WINDOWS) { if (exports.IS_WINDOWS) {
try { try {
const directory = path.dirname(filePath); const directory = path2.dirname(filePath);
const upperName = path.basename(filePath).toUpperCase(); const upperName = path2.basename(filePath).toUpperCase();
for (const actualName of yield exports.readdir(directory)) { for (const actualName of yield exports.readdir(directory)) {
if (upperName === actualName.toUpperCase()) { if (upperName === actualName.toUpperCase()) {
filePath = path.join(directory, actualName); filePath = path2.join(directory, actualName);
break; break;
} }
} }
@ -2464,7 +2464,7 @@ var require_io = __commonJS({
Object.defineProperty(exports, "__esModule", { value: true }); Object.defineProperty(exports, "__esModule", { value: true });
exports.findInPath = exports.which = exports.mkdirP = exports.rmRF = exports.mv = exports.cp = void 0; exports.findInPath = exports.which = exports.mkdirP = exports.rmRF = exports.mv = exports.cp = void 0;
var assert_1 = require("assert"); var assert_1 = require("assert");
var path = __importStar2(require("path")); var path2 = __importStar2(require("path"));
var ioUtil = __importStar2(require_io_util()); var ioUtil = __importStar2(require_io_util());
function cp2(source, dest, options = {}) { function cp2(source, dest, options = {}) {
return __awaiter2(this, void 0, void 0, function* () { return __awaiter2(this, void 0, void 0, function* () {
@ -2473,7 +2473,7 @@ var require_io = __commonJS({
if (destStat && destStat.isFile() && !force) { if (destStat && destStat.isFile() && !force) {
return; return;
} }
const newDest = destStat && destStat.isDirectory() && copySourceDirectory ? path.join(dest, path.basename(source)) : dest; const newDest = destStat && destStat.isDirectory() && copySourceDirectory ? path2.join(dest, path2.basename(source)) : dest;
if (!(yield ioUtil.exists(source))) { if (!(yield ioUtil.exists(source))) {
throw new Error(`no such file or directory: ${source}`); throw new Error(`no such file or directory: ${source}`);
} }
@ -2485,7 +2485,7 @@ var require_io = __commonJS({
yield cpDirRecursive(source, newDest, 0, force); yield cpDirRecursive(source, newDest, 0, force);
} }
} else { } else {
if (path.relative(source, newDest) === "") { if (path2.relative(source, newDest) === "") {
throw new Error(`'${newDest}' and '${source}' are the same file`); throw new Error(`'${newDest}' and '${source}' are the same file`);
} }
yield copyFile(source, newDest, force); yield copyFile(source, newDest, force);
@ -2498,7 +2498,7 @@ var require_io = __commonJS({
if (yield ioUtil.exists(dest)) { if (yield ioUtil.exists(dest)) {
let destExists = true; let destExists = true;
if (yield ioUtil.isDirectory(dest)) { if (yield ioUtil.isDirectory(dest)) {
dest = path.join(dest, path.basename(source)); dest = path2.join(dest, path2.basename(source));
destExists = yield ioUtil.exists(dest); destExists = yield ioUtil.exists(dest);
} }
if (destExists) { if (destExists) {
@ -2509,7 +2509,7 @@ var require_io = __commonJS({
} }
} }
} }
yield mkdirP2(path.dirname(dest)); yield mkdirP2(path2.dirname(dest));
yield ioUtil.rename(source, dest); yield ioUtil.rename(source, dest);
}); });
} }
@ -2572,7 +2572,7 @@ var require_io = __commonJS({
} }
const extensions = []; const extensions = [];
if (ioUtil.IS_WINDOWS && process.env["PATHEXT"]) { if (ioUtil.IS_WINDOWS && process.env["PATHEXT"]) {
for (const extension of process.env["PATHEXT"].split(path.delimiter)) { for (const extension of process.env["PATHEXT"].split(path2.delimiter)) {
if (extension) { if (extension) {
extensions.push(extension); extensions.push(extension);
} }
@ -2585,12 +2585,12 @@ var require_io = __commonJS({
} }
return []; return [];
} }
if (tool.includes(path.sep)) { if (tool.includes(path2.sep)) {
return []; return [];
} }
const directories = []; const directories = [];
if (process.env.PATH) { if (process.env.PATH) {
for (const p of process.env.PATH.split(path.delimiter)) { for (const p of process.env.PATH.split(path2.delimiter)) {
if (p) { if (p) {
directories.push(p); directories.push(p);
} }
@ -2598,7 +2598,7 @@ var require_io = __commonJS({
} }
const matches = []; const matches = [];
for (const directory of directories) { for (const directory of directories) {
const filePath = yield ioUtil.tryGetExecutablePath(path.join(directory, tool), extensions); const filePath = yield ioUtil.tryGetExecutablePath(path2.join(directory, tool), extensions);
if (filePath) { if (filePath) {
matches.push(filePath); matches.push(filePath);
} }
@ -4083,7 +4083,7 @@ var require_toolrunner = __commonJS({
var os = __importStar2(require("os")); var os = __importStar2(require("os"));
var events = __importStar2(require("events")); var events = __importStar2(require("events"));
var child = __importStar2(require("child_process")); var child = __importStar2(require("child_process"));
var path = __importStar2(require("path")); var path2 = __importStar2(require("path"));
var io = __importStar2(require_io()); var io = __importStar2(require_io());
var ioUtil = __importStar2(require_io_util()); var ioUtil = __importStar2(require_io_util());
var timers_1 = require("timers"); var timers_1 = require("timers");
@ -4298,7 +4298,7 @@ var require_toolrunner = __commonJS({
exec() { exec() {
return __awaiter2(this, void 0, void 0, function* () { return __awaiter2(this, void 0, void 0, function* () {
if (!ioUtil.isRooted(this.toolPath) && (this.toolPath.includes("/") || IS_WINDOWS && this.toolPath.includes("\\"))) { if (!ioUtil.isRooted(this.toolPath) && (this.toolPath.includes("/") || IS_WINDOWS && this.toolPath.includes("\\"))) {
this.toolPath = path.resolve(process.cwd(), this.options.cwd || process.cwd(), this.toolPath); this.toolPath = path2.resolve(process.cwd(), this.options.cwd || process.cwd(), this.toolPath);
} }
this.toolPath = yield io.which(this.toolPath, true); this.toolPath = yield io.which(this.toolPath, true);
return new Promise((resolve, reject) => __awaiter2(this, void 0, void 0, function* () { return new Promise((resolve, reject) => __awaiter2(this, void 0, void 0, function* () {
@ -4796,7 +4796,7 @@ var require_tool_cache = __commonJS({
var fs = __importStar2(require("fs")); var fs = __importStar2(require("fs"));
var mm = __importStar2(require_manifest()); var mm = __importStar2(require_manifest());
var os = __importStar2(require("os")); var os = __importStar2(require("os"));
var path = __importStar2(require("path")); var path2 = __importStar2(require("path"));
var httpm = __importStar2(require_lib()); var httpm = __importStar2(require_lib());
var semver = __importStar2(require_semver()); var semver = __importStar2(require_semver());
var stream = __importStar2(require("stream")); var stream = __importStar2(require("stream"));
@ -4818,8 +4818,8 @@ var require_tool_cache = __commonJS({
var userAgent = "actions/tool-cache"; var userAgent = "actions/tool-cache";
function downloadTool2(url, dest, auth, headers) { function downloadTool2(url, dest, auth, headers) {
return __awaiter2(this, void 0, void 0, function* () { return __awaiter2(this, void 0, void 0, function* () {
dest = dest || path.join(_getTempDirectory(), v4_1.default()); dest = dest || path2.join(_getTempDirectory(), v4_1.default());
yield io.mkdirP(path.dirname(dest)); yield io.mkdirP(path2.dirname(dest));
core.debug(`Downloading ${url}`); core.debug(`Downloading ${url}`);
core.debug(`Destination ${dest}`); core.debug(`Destination ${dest}`);
const maxAttempts = 3; const maxAttempts = 3;
@ -4906,7 +4906,7 @@ var require_tool_cache = __commonJS({
process.chdir(originalCwd); process.chdir(originalCwd);
} }
} else { } else {
const escapedScript = path.join(__dirname, "..", "scripts", "Invoke-7zdec.ps1").replace(/'/g, "''").replace(/"|\n|\r/g, ""); const escapedScript = path2.join(__dirname, "..", "scripts", "Invoke-7zdec.ps1").replace(/'/g, "''").replace(/"|\n|\r/g, "");
const escapedFile = file.replace(/'/g, "''").replace(/"|\n|\r/g, ""); const escapedFile = file.replace(/'/g, "''").replace(/"|\n|\r/g, "");
const escapedTarget = dest.replace(/'/g, "''").replace(/"|\n|\r/g, ""); const escapedTarget = dest.replace(/'/g, "''").replace(/"|\n|\r/g, "");
const command = `& '${escapedScript}' -Source '${escapedFile}' -Target '${escapedTarget}'`; const command = `& '${escapedScript}' -Source '${escapedFile}' -Target '${escapedTarget}'`;
@ -5082,7 +5082,7 @@ var require_tool_cache = __commonJS({
} }
const destPath = yield _createToolPath(tool, version3, arch); const destPath = yield _createToolPath(tool, version3, arch);
for (const itemName of fs.readdirSync(sourceDir)) { for (const itemName of fs.readdirSync(sourceDir)) {
const s = path.join(sourceDir, itemName); const s = path2.join(sourceDir, itemName);
yield io.cp(s, destPath, { recursive: true }); yield io.cp(s, destPath, { recursive: true });
} }
_completeToolPath(tool, version3, arch); _completeToolPath(tool, version3, arch);
@ -5100,7 +5100,7 @@ var require_tool_cache = __commonJS({
throw new Error("sourceFile is not a file"); throw new Error("sourceFile is not a file");
} }
const destFolder = yield _createToolPath(tool, version3, arch); const destFolder = yield _createToolPath(tool, version3, arch);
const destPath = path.join(destFolder, targetFile); const destPath = path2.join(destFolder, targetFile);
core.debug(`destination file ${destPath}`); core.debug(`destination file ${destPath}`);
yield io.cp(sourceFile, destPath); yield io.cp(sourceFile, destPath);
_completeToolPath(tool, version3, arch); _completeToolPath(tool, version3, arch);
@ -5124,7 +5124,7 @@ var require_tool_cache = __commonJS({
let toolPath = ""; let toolPath = "";
if (versionSpec) { if (versionSpec) {
versionSpec = semver.clean(versionSpec) || ""; versionSpec = semver.clean(versionSpec) || "";
const cachePath = path.join(_getCacheDirectory(), toolName, versionSpec, arch); const cachePath = path2.join(_getCacheDirectory(), toolName, versionSpec, arch);
core.debug(`checking cache: ${cachePath}`); core.debug(`checking cache: ${cachePath}`);
if (fs.existsSync(cachePath) && fs.existsSync(`${cachePath}.complete`)) { if (fs.existsSync(cachePath) && fs.existsSync(`${cachePath}.complete`)) {
core.debug(`Found tool in cache ${toolName} ${versionSpec} ${arch}`); core.debug(`Found tool in cache ${toolName} ${versionSpec} ${arch}`);
@ -5139,12 +5139,12 @@ var require_tool_cache = __commonJS({
function findAllVersions(toolName, arch) { function findAllVersions(toolName, arch) {
const versions = []; const versions = [];
arch = arch || os.arch(); arch = arch || os.arch();
const toolPath = path.join(_getCacheDirectory(), toolName); const toolPath = path2.join(_getCacheDirectory(), toolName);
if (fs.existsSync(toolPath)) { if (fs.existsSync(toolPath)) {
const children2 = fs.readdirSync(toolPath); const children2 = fs.readdirSync(toolPath);
for (const child of children2) { for (const child of children2) {
if (isExplicitVersion(child)) { if (isExplicitVersion(child)) {
const fullPath = path.join(toolPath, child, arch || ""); const fullPath = path2.join(toolPath, child, arch || "");
if (fs.existsSync(fullPath) && fs.existsSync(`${fullPath}.complete`)) { if (fs.existsSync(fullPath) && fs.existsSync(`${fullPath}.complete`)) {
versions.push(child); versions.push(child);
} }
@ -5199,7 +5199,7 @@ var require_tool_cache = __commonJS({
function _createExtractFolder(dest) { function _createExtractFolder(dest) {
return __awaiter2(this, void 0, void 0, function* () { return __awaiter2(this, void 0, void 0, function* () {
if (!dest) { if (!dest) {
dest = path.join(_getTempDirectory(), v4_1.default()); dest = path2.join(_getTempDirectory(), v4_1.default());
} }
yield io.mkdirP(dest); yield io.mkdirP(dest);
return dest; return dest;
@ -5207,7 +5207,7 @@ var require_tool_cache = __commonJS({
} }
function _createToolPath(tool, version3, arch) { function _createToolPath(tool, version3, arch) {
return __awaiter2(this, void 0, void 0, function* () { return __awaiter2(this, void 0, void 0, function* () {
const folderPath = path.join(_getCacheDirectory(), tool, semver.clean(version3) || version3, arch || ""); const folderPath = path2.join(_getCacheDirectory(), tool, semver.clean(version3) || version3, arch || "");
core.debug(`destination ${folderPath}`); core.debug(`destination ${folderPath}`);
const markerPath = `${folderPath}.complete`; const markerPath = `${folderPath}.complete`;
yield io.rmRF(folderPath); yield io.rmRF(folderPath);
@ -5217,7 +5217,7 @@ var require_tool_cache = __commonJS({
}); });
} }
function _completeToolPath(tool, version3, arch) { function _completeToolPath(tool, version3, arch) {
const folderPath = path.join(_getCacheDirectory(), tool, semver.clean(version3) || version3, arch || ""); const folderPath = path2.join(_getCacheDirectory(), tool, semver.clean(version3) || version3, arch || "");
const markerPath = `${folderPath}.complete`; const markerPath = `${folderPath}.complete`;
fs.writeFileSync(markerPath, ""); fs.writeFileSync(markerPath, "");
core.debug("finished caching tool"); core.debug("finished caching tool");
@ -5373,7 +5373,7 @@ var require_internal_path_helper = __commonJS({
}; };
Object.defineProperty(exports, "__esModule", { value: true }); Object.defineProperty(exports, "__esModule", { value: true });
exports.safeTrimTrailingSeparator = exports.normalizeSeparators = exports.hasRoot = exports.hasAbsoluteRoot = exports.ensureAbsoluteRoot = exports.dirname = void 0; exports.safeTrimTrailingSeparator = exports.normalizeSeparators = exports.hasRoot = exports.hasAbsoluteRoot = exports.ensureAbsoluteRoot = exports.dirname = void 0;
var path = __importStar2(require("path")); var path2 = __importStar2(require("path"));
var assert_1 = __importDefault2(require("assert")); var assert_1 = __importDefault2(require("assert"));
var IS_WINDOWS = process.platform === "win32"; var IS_WINDOWS = process.platform === "win32";
function dirname(p) { function dirname(p) {
@ -5381,7 +5381,7 @@ var require_internal_path_helper = __commonJS({
if (IS_WINDOWS && /^\\\\[^\\]+(\\[^\\]+)?$/.test(p)) { if (IS_WINDOWS && /^\\\\[^\\]+(\\[^\\]+)?$/.test(p)) {
return p; return p;
} }
let result = path.dirname(p); let result = path2.dirname(p);
if (IS_WINDOWS && /^\\\\[^\\]+\\[^\\]+\\$/.test(result)) { if (IS_WINDOWS && /^\\\\[^\\]+\\[^\\]+\\$/.test(result)) {
result = safeTrimTrailingSeparator(result); result = safeTrimTrailingSeparator(result);
} }
@ -5419,7 +5419,7 @@ var require_internal_path_helper = __commonJS({
assert_1.default(hasAbsoluteRoot(root), `ensureAbsoluteRoot parameter 'root' must have an absolute root`); assert_1.default(hasAbsoluteRoot(root), `ensureAbsoluteRoot parameter 'root' must have an absolute root`);
if (root.endsWith("/") || IS_WINDOWS && root.endsWith("\\")) { if (root.endsWith("/") || IS_WINDOWS && root.endsWith("\\")) {
} else { } else {
root += path.sep; root += path2.sep;
} }
return root + itemPath; return root + itemPath;
} }
@ -5457,10 +5457,10 @@ var require_internal_path_helper = __commonJS({
return ""; return "";
} }
p = normalizeSeparators(p); p = normalizeSeparators(p);
if (!p.endsWith(path.sep)) { if (!p.endsWith(path2.sep)) {
return p; return p;
} }
if (p === path.sep) { if (p === path2.sep) {
return p; return p;
} }
if (IS_WINDOWS && /^[A-Z]:\\$/i.test(p)) { if (IS_WINDOWS && /^[A-Z]:\\$/i.test(p)) {
@ -5806,7 +5806,7 @@ var require_minimatch = __commonJS({
"node_modules/minimatch/minimatch.js"(exports, module2) { "node_modules/minimatch/minimatch.js"(exports, module2) {
module2.exports = minimatch; module2.exports = minimatch;
minimatch.Minimatch = Minimatch; minimatch.Minimatch = Minimatch;
var path = function() { var path2 = function() {
try { try {
return require("path"); return require("path");
} catch (e) { } catch (e) {
@ -5814,7 +5814,7 @@ var require_minimatch = __commonJS({
}() || { }() || {
sep: "/" sep: "/"
}; };
minimatch.sep = path.sep; minimatch.sep = path2.sep;
var GLOBSTAR = minimatch.GLOBSTAR = Minimatch.GLOBSTAR = {}; var GLOBSTAR = minimatch.GLOBSTAR = Minimatch.GLOBSTAR = {};
var expand = require_brace_expansion(); var expand = require_brace_expansion();
var plTypes = { var plTypes = {
@ -5905,8 +5905,8 @@ var require_minimatch = __commonJS({
if (!options) if (!options)
options = {}; options = {};
pattern = pattern.trim(); pattern = pattern.trim();
if (path.sep !== "/") { if (path2.sep !== "/") {
pattern = pattern.split(path.sep).join("/"); pattern = pattern.split(path2.sep).join("/");
} }
this.options = options; this.options = options;
this.set = []; this.set = [];
@ -6283,8 +6283,8 @@ var require_minimatch = __commonJS({
if (f === "/" && partial) if (f === "/" && partial)
return true; return true;
var options = this.options; var options = this.options;
if (path.sep !== "/") { if (path2.sep !== "/") {
f = f.split(path.sep).join("/"); f = f.split(path2.sep).join("/");
} }
f = f.split(slashSplit); f = f.split(slashSplit);
this.debug(this.pattern, "split", f); this.debug(this.pattern, "split", f);
@ -6428,7 +6428,7 @@ var require_internal_path = __commonJS({
}; };
Object.defineProperty(exports, "__esModule", { value: true }); Object.defineProperty(exports, "__esModule", { value: true });
exports.Path = void 0; exports.Path = void 0;
var path = __importStar2(require("path")); var path2 = __importStar2(require("path"));
var pathHelper = __importStar2(require_internal_path_helper()); var pathHelper = __importStar2(require_internal_path_helper());
var assert_1 = __importDefault2(require("assert")); var assert_1 = __importDefault2(require("assert"));
var IS_WINDOWS = process.platform === "win32"; var IS_WINDOWS = process.platform === "win32";
@ -6443,12 +6443,12 @@ var require_internal_path = __commonJS({
assert_1.default(itemPath, `Parameter 'itemPath' must not be empty`); assert_1.default(itemPath, `Parameter 'itemPath' must not be empty`);
itemPath = pathHelper.safeTrimTrailingSeparator(itemPath); itemPath = pathHelper.safeTrimTrailingSeparator(itemPath);
if (!pathHelper.hasRoot(itemPath)) { if (!pathHelper.hasRoot(itemPath)) {
this.segments = itemPath.split(path.sep); this.segments = itemPath.split(path2.sep);
} else { } else {
let remaining = itemPath; let remaining = itemPath;
let dir = pathHelper.dirname(remaining); let dir = pathHelper.dirname(remaining);
while (dir !== remaining) { while (dir !== remaining) {
const basename = path.basename(remaining); const basename = path2.basename(remaining);
this.segments.unshift(basename); this.segments.unshift(basename);
remaining = dir; remaining = dir;
dir = pathHelper.dirname(remaining); dir = pathHelper.dirname(remaining);
@ -6466,7 +6466,7 @@ var require_internal_path = __commonJS({
assert_1.default(segment === pathHelper.dirname(segment), `Parameter 'itemPath' root segment contains information for multiple segments`); assert_1.default(segment === pathHelper.dirname(segment), `Parameter 'itemPath' root segment contains information for multiple segments`);
this.segments.push(segment); this.segments.push(segment);
} else { } else {
assert_1.default(!segment.includes(path.sep), `Parameter 'itemPath' contains unexpected path separators`); assert_1.default(!segment.includes(path2.sep), `Parameter 'itemPath' contains unexpected path separators`);
this.segments.push(segment); this.segments.push(segment);
} }
} }
@ -6477,12 +6477,12 @@ var require_internal_path = __commonJS({
*/ */
toString() { toString() {
let result = this.segments[0]; let result = this.segments[0];
let skipSlash = result.endsWith(path.sep) || IS_WINDOWS && /^[A-Z]:$/i.test(result); let skipSlash = result.endsWith(path2.sep) || IS_WINDOWS && /^[A-Z]:$/i.test(result);
for (let i = 1; i < this.segments.length; i++) { for (let i = 1; i < this.segments.length; i++) {
if (skipSlash) { if (skipSlash) {
skipSlash = false; skipSlash = false;
} else { } else {
result += path.sep; result += path2.sep;
} }
result += this.segments[i]; result += this.segments[i];
} }
@ -6531,7 +6531,7 @@ var require_internal_pattern = __commonJS({
Object.defineProperty(exports, "__esModule", { value: true }); Object.defineProperty(exports, "__esModule", { value: true });
exports.Pattern = void 0; exports.Pattern = void 0;
var os = __importStar2(require("os")); var os = __importStar2(require("os"));
var path = __importStar2(require("path")); var path2 = __importStar2(require("path"));
var pathHelper = __importStar2(require_internal_path_helper()); var pathHelper = __importStar2(require_internal_path_helper());
var assert_1 = __importDefault2(require("assert")); var assert_1 = __importDefault2(require("assert"));
var minimatch_1 = require_minimatch(); var minimatch_1 = require_minimatch();
@ -6560,7 +6560,7 @@ var require_internal_pattern = __commonJS({
} }
pattern = _Pattern.fixupPattern(pattern, homedir2); pattern = _Pattern.fixupPattern(pattern, homedir2);
this.segments = new internal_path_1.Path(pattern).segments; this.segments = new internal_path_1.Path(pattern).segments;
this.trailingSeparator = pathHelper.normalizeSeparators(pattern).endsWith(path.sep); this.trailingSeparator = pathHelper.normalizeSeparators(pattern).endsWith(path2.sep);
pattern = pathHelper.safeTrimTrailingSeparator(pattern); pattern = pathHelper.safeTrimTrailingSeparator(pattern);
let foundGlob = false; let foundGlob = false;
const searchSegments = this.segments.map((x) => _Pattern.getLiteral(x)).filter((x) => !foundGlob && !(foundGlob = x === "")); const searchSegments = this.segments.map((x) => _Pattern.getLiteral(x)).filter((x) => !foundGlob && !(foundGlob = x === ""));
@ -6584,8 +6584,8 @@ var require_internal_pattern = __commonJS({
match(itemPath) { match(itemPath) {
if (this.segments[this.segments.length - 1] === "**") { if (this.segments[this.segments.length - 1] === "**") {
itemPath = pathHelper.normalizeSeparators(itemPath); itemPath = pathHelper.normalizeSeparators(itemPath);
if (!itemPath.endsWith(path.sep) && this.isImplicitPattern === false) { if (!itemPath.endsWith(path2.sep) && this.isImplicitPattern === false) {
itemPath = `${itemPath}${path.sep}`; itemPath = `${itemPath}${path2.sep}`;
} }
} else { } else {
itemPath = pathHelper.safeTrimTrailingSeparator(itemPath); itemPath = pathHelper.safeTrimTrailingSeparator(itemPath);
@ -6620,9 +6620,9 @@ var require_internal_pattern = __commonJS({
assert_1.default(literalSegments.every((x, i) => (x !== "." || i === 0) && x !== ".."), `Invalid pattern '${pattern}'. Relative pathing '.' and '..' is not allowed.`); assert_1.default(literalSegments.every((x, i) => (x !== "." || i === 0) && x !== ".."), `Invalid pattern '${pattern}'. Relative pathing '.' and '..' is not allowed.`);
assert_1.default(!pathHelper.hasRoot(pattern) || literalSegments[0], `Invalid pattern '${pattern}'. Root segment must not contain globs.`); assert_1.default(!pathHelper.hasRoot(pattern) || literalSegments[0], `Invalid pattern '${pattern}'. Root segment must not contain globs.`);
pattern = pathHelper.normalizeSeparators(pattern); pattern = pathHelper.normalizeSeparators(pattern);
if (pattern === "." || pattern.startsWith(`.${path.sep}`)) { if (pattern === "." || pattern.startsWith(`.${path2.sep}`)) {
pattern = _Pattern.globEscape(process.cwd()) + pattern.substr(1); pattern = _Pattern.globEscape(process.cwd()) + pattern.substr(1);
} else if (pattern === "~" || pattern.startsWith(`~${path.sep}`)) { } else if (pattern === "~" || pattern.startsWith(`~${path2.sep}`)) {
homedir2 = homedir2 || os.homedir(); homedir2 = homedir2 || os.homedir();
assert_1.default(homedir2, "Unable to determine HOME directory"); assert_1.default(homedir2, "Unable to determine HOME directory");
assert_1.default(pathHelper.hasAbsoluteRoot(homedir2), `Expected HOME directory to be a rooted path. Actual '${homedir2}'`); assert_1.default(pathHelper.hasAbsoluteRoot(homedir2), `Expected HOME directory to be a rooted path. Actual '${homedir2}'`);
@ -6706,8 +6706,8 @@ var require_internal_search_state = __commonJS({
Object.defineProperty(exports, "__esModule", { value: true }); Object.defineProperty(exports, "__esModule", { value: true });
exports.SearchState = void 0; exports.SearchState = void 0;
var SearchState = class { var SearchState = class {
constructor(path, level) { constructor(path2, level) {
this.path = path; this.path = path2;
this.level = level; this.level = level;
} }
}; };
@ -6838,7 +6838,7 @@ var require_internal_globber = __commonJS({
var core = __importStar2(require_core()); var core = __importStar2(require_core());
var fs = __importStar2(require("fs")); var fs = __importStar2(require("fs"));
var globOptionsHelper = __importStar2(require_internal_glob_options_helper()); var globOptionsHelper = __importStar2(require_internal_glob_options_helper());
var path = __importStar2(require("path")); var path2 = __importStar2(require("path"));
var patternHelper = __importStar2(require_internal_pattern_helper()); var patternHelper = __importStar2(require_internal_pattern_helper());
var internal_match_kind_1 = require_internal_match_kind(); var internal_match_kind_1 = require_internal_match_kind();
var internal_pattern_1 = require_internal_pattern(); var internal_pattern_1 = require_internal_pattern();
@ -6921,7 +6921,7 @@ var require_internal_globber = __commonJS({
continue; continue;
} }
const childLevel = item.level + 1; const childLevel = item.level + 1;
const childItems = (yield __await2(fs.promises.readdir(item.path))).map((x) => new internal_search_state_1.SearchState(path.join(item.path, x), childLevel)); const childItems = (yield __await2(fs.promises.readdir(item.path))).map((x) => new internal_search_state_1.SearchState(path2.join(item.path, x), childLevel));
stack.push(...childItems.reverse()); stack.push(...childItems.reverse());
} else if (match & internal_match_kind_1.MatchKind.File) { } else if (match & internal_match_kind_1.MatchKind.File) {
yield yield __await2(item.path); yield yield __await2(item.path);
@ -7234,7 +7234,7 @@ var require_cacheUtils = __commonJS({
var glob = __importStar2(require_glob()); var glob = __importStar2(require_glob());
var io = __importStar2(require_io()); var io = __importStar2(require_io());
var fs = __importStar2(require("fs")); var fs = __importStar2(require("fs"));
var path = __importStar2(require("path")); var path2 = __importStar2(require("path"));
var semver = __importStar2(require_semver()); var semver = __importStar2(require_semver());
var util = __importStar2(require("util")); var util = __importStar2(require("util"));
var uuid_1 = require_uuid(); var uuid_1 = require_uuid();
@ -7254,9 +7254,9 @@ var require_cacheUtils = __commonJS({
baseLocation = "/home"; baseLocation = "/home";
} }
} }
tempDirectory = path.join(baseLocation, "actions", "temp"); tempDirectory = path2.join(baseLocation, "actions", "temp");
} }
const dest = path.join(tempDirectory, (0, uuid_1.v4)()); const dest = path2.join(tempDirectory, (0, uuid_1.v4)());
yield io.mkdirP(dest); yield io.mkdirP(dest);
return dest; return dest;
}); });
@ -7281,7 +7281,7 @@ var require_cacheUtils = __commonJS({
_e = false; _e = false;
try { try {
const file = _c; const file = _c;
const relativeFile = path.relative(workspace, file).replace(new RegExp(`\\${path.sep}`, "g"), "/"); const relativeFile = path2.relative(workspace, file).replace(new RegExp(`\\${path2.sep}`, "g"), "/");
core.debug(`Matched: ${relativeFile}`); core.debug(`Matched: ${relativeFile}`);
if (relativeFile === "") { if (relativeFile === "") {
paths.push("."); paths.push(".");
@ -23684,11 +23684,11 @@ var require_mime_types = __commonJS({
} }
return exts[0]; return exts[0];
} }
function lookup(path) { function lookup(path2) {
if (!path || typeof path !== "string") { if (!path2 || typeof path2 !== "string") {
return false; return false;
} }
var extension2 = extname("x." + path).toLowerCase().substr(1); var extension2 = extname("x." + path2).toLowerCase().substr(1);
if (!extension2) { if (!extension2) {
return false; return false;
} }
@ -23945,7 +23945,7 @@ var require_form_data = __commonJS({
"node_modules/@azure/core-http/node_modules/form-data/lib/form_data.js"(exports, module2) { "node_modules/@azure/core-http/node_modules/form-data/lib/form_data.js"(exports, module2) {
var CombinedStream = require_combined_stream(); var CombinedStream = require_combined_stream();
var util = require("util"); var util = require("util");
var path = require("path"); var path2 = require("path");
var http = require("http"); var http = require("http");
var https = require("https"); var https = require("https");
var parseUrl = require("url").parse; var parseUrl = require("url").parse;
@ -24072,11 +24072,11 @@ var require_form_data = __commonJS({
FormData.prototype._getContentDisposition = function(value, options) { FormData.prototype._getContentDisposition = function(value, options) {
var filename, contentDisposition; var filename, contentDisposition;
if (typeof options.filepath === "string") { if (typeof options.filepath === "string") {
filename = path.normalize(options.filepath).replace(/\\/g, "/"); filename = path2.normalize(options.filepath).replace(/\\/g, "/");
} else if (options.filename || value.name || value.path) { } else if (options.filename || value.name || value.path) {
filename = path.basename(options.filename || value.name || value.path); filename = path2.basename(options.filename || value.name || value.path);
} else if (value.readable && value.hasOwnProperty("httpVersion")) { } else if (value.readable && value.hasOwnProperty("httpVersion")) {
filename = path.basename(value.client._httpMessage.path || ""); filename = path2.basename(value.client._httpMessage.path || "");
} }
if (filename) { if (filename) {
contentDisposition = 'filename="' + filename + '"'; contentDisposition = 'filename="' + filename + '"';
@ -24992,14 +24992,14 @@ var require_url_state_machine = __commonJS({
return url.replace(/\u0009|\u000A|\u000D/g, ""); return url.replace(/\u0009|\u000A|\u000D/g, "");
} }
function shortenPath(url) { function shortenPath(url) {
const path = url.path; const path2 = url.path;
if (path.length === 0) { if (path2.length === 0) {
return; return;
} }
if (url.scheme === "file" && path.length === 1 && isNormalizedWindowsDriveLetter(path[0])) { if (url.scheme === "file" && path2.length === 1 && isNormalizedWindowsDriveLetter(path2[0])) {
return; return;
} }
path.pop(); path2.pop();
} }
function includesCredentials(url) { function includesCredentials(url) {
return url.username !== "" || url.password !== ""; return url.username !== "" || url.password !== "";
@ -30509,16 +30509,16 @@ var require_dist6 = __commonJS({
* Set the path for this URL. If the provided path contains a query, then it will be added to * Set the path for this URL. If the provided path contains a query, then it will be added to
* this URL as well. * this URL as well.
*/ */
setPath(path) { setPath(path2) {
if (!path) { if (!path2) {
this._path = void 0; this._path = void 0;
} else { } else {
const schemeIndex = path.indexOf("://"); const schemeIndex = path2.indexOf("://");
if (schemeIndex !== -1) { if (schemeIndex !== -1) {
const schemeStart = path.lastIndexOf("/", schemeIndex); const schemeStart = path2.lastIndexOf("/", schemeIndex);
this.set(schemeStart === -1 ? path : path.substr(schemeStart + 1), "SCHEME"); this.set(schemeStart === -1 ? path2 : path2.substr(schemeStart + 1), "SCHEME");
} else { } else {
this.set(path, "PATH"); this.set(path2, "PATH");
} }
} }
} }
@ -30526,19 +30526,19 @@ var require_dist6 = __commonJS({
* Append the provided path to this URL's existing path. If the provided path contains a query, * Append the provided path to this URL's existing path. If the provided path contains a query,
* then it will be added to this URL as well. * then it will be added to this URL as well.
*/ */
appendPath(path) { appendPath(path2) {
if (path) { if (path2) {
let currentPath = this.getPath(); let currentPath = this.getPath();
if (currentPath) { if (currentPath) {
if (!currentPath.endsWith("/")) { if (!currentPath.endsWith("/")) {
currentPath += "/"; currentPath += "/";
} }
if (path.startsWith("/")) { if (path2.startsWith("/")) {
path = path.substring(1); path2 = path2.substring(1);
} }
path = currentPath + path; path2 = currentPath + path2;
} }
this.set(path, "PATH"); this.set(path2, "PATH");
} }
} }
/** /**
@ -30847,8 +30847,8 @@ var require_dist6 = __commonJS({
} }
} }
function nextPath(tokenizer) { function nextPath(tokenizer) {
const path = readUntilCharacter(tokenizer, "?"); const path2 = readUntilCharacter(tokenizer, "?");
tokenizer._currentToken = URLToken.path(path); tokenizer._currentToken = URLToken.path(path2);
if (!hasCurrentCharacter(tokenizer)) { if (!hasCurrentCharacter(tokenizer)) {
tokenizer._currentState = "DONE"; tokenizer._currentState = "DONE";
} else { } else {
@ -47908,10 +47908,10 @@ var require_dist9 = __commonJS({
]; ];
function escapeURLPath(url2) { function escapeURLPath(url2) {
const urlParsed = coreHttp.URLBuilder.parse(url2); const urlParsed = coreHttp.URLBuilder.parse(url2);
let path = urlParsed.getPath(); let path2 = urlParsed.getPath();
path = path || "/"; path2 = path2 || "/";
path = escape(path); path2 = escape(path2);
urlParsed.setPath(path); urlParsed.setPath(path2);
return urlParsed.toString(); return urlParsed.toString();
} }
function getProxyUriFromDevConnString(connectionString) { function getProxyUriFromDevConnString(connectionString) {
@ -47990,9 +47990,9 @@ var require_dist9 = __commonJS({
} }
function appendToURLPath(url2, name) { function appendToURLPath(url2, name) {
const urlParsed = coreHttp.URLBuilder.parse(url2); const urlParsed = coreHttp.URLBuilder.parse(url2);
let path = urlParsed.getPath(); let path2 = urlParsed.getPath();
path = path ? path.endsWith("/") ? `${path}${name}` : `${path}/${name}` : name; path2 = path2 ? path2.endsWith("/") ? `${path2}${name}` : `${path2}/${name}` : name;
urlParsed.setPath(path); urlParsed.setPath(path2);
const normalizedUrl = new URL(urlParsed.toString()); const normalizedUrl = new URL(urlParsed.toString());
return normalizedUrl.toString(); return normalizedUrl.toString();
} }
@ -48992,9 +48992,9 @@ var require_dist9 = __commonJS({
* @param request - * @param request -
*/ */
getCanonicalizedResourceString(request) { getCanonicalizedResourceString(request) {
const path = getURLPath(request.url) || "/"; const path2 = getURLPath(request.url) || "/";
let canonicalizedResourceString = ""; let canonicalizedResourceString = "";
canonicalizedResourceString += `/${this.factory.accountName}${path}`; canonicalizedResourceString += `/${this.factory.accountName}${path2}`;
const queries = getURLQueries(request.url); const queries = getURLQueries(request.url);
const lowercaseQueries = {}; const lowercaseQueries = {};
if (queries) { if (queries) {
@ -55097,8 +55097,8 @@ ${key}:${decodeURIComponent(lowercaseQueries[key])}`;
if (this.operationCount >= BATCH_MAX_REQUEST) { if (this.operationCount >= BATCH_MAX_REQUEST) {
throw new RangeError(`Cannot exceed ${BATCH_MAX_REQUEST} sub requests in a single batch`); throw new RangeError(`Cannot exceed ${BATCH_MAX_REQUEST} sub requests in a single batch`);
} }
const path = getURLPath(subRequest.url); const path2 = getURLPath(subRequest.url);
if (!path || path === "") { if (!path2 || path2 === "") {
throw new RangeError(`Invalid url for sub request: '${subRequest.url}'`); throw new RangeError(`Invalid url for sub request: '${subRequest.url}'`);
} }
} }
@ -55175,8 +55175,8 @@ ${key}:${decodeURIComponent(lowercaseQueries[key])}`;
pipeline = newPipeline(credentialOrPipeline, options); pipeline = newPipeline(credentialOrPipeline, options);
} }
const storageClientContext = new StorageClientContext(url2, pipeline.toServiceClientOptions()); const storageClientContext = new StorageClientContext(url2, pipeline.toServiceClientOptions());
const path = getURLPath(url2); const path2 = getURLPath(url2);
if (path && path !== "/") { if (path2 && path2 !== "/") {
this.serviceOrContainerContext = new Container(storageClientContext); this.serviceOrContainerContext = new Container(storageClientContext);
} else { } else {
this.serviceOrContainerContext = new Service(storageClientContext); this.serviceOrContainerContext = new Service(storageClientContext);
@ -58581,7 +58581,7 @@ var require_tar = __commonJS({
var exec_1 = require_exec(); var exec_1 = require_exec();
var io = __importStar2(require_io()); var io = __importStar2(require_io());
var fs_1 = require("fs"); var fs_1 = require("fs");
var path = __importStar2(require("path")); var path2 = __importStar2(require("path"));
var utils = __importStar2(require_cacheUtils()); var utils = __importStar2(require_cacheUtils());
var constants_1 = require_constants(); var constants_1 = require_constants();
var IS_WINDOWS = process.platform === "win32"; var IS_WINDOWS = process.platform === "win32";
@ -58627,13 +58627,13 @@ var require_tar = __commonJS({
const BSD_TAR_ZSTD = tarPath.type === constants_1.ArchiveToolType.BSD && compressionMethod !== constants_1.CompressionMethod.Gzip && IS_WINDOWS; const BSD_TAR_ZSTD = tarPath.type === constants_1.ArchiveToolType.BSD && compressionMethod !== constants_1.CompressionMethod.Gzip && IS_WINDOWS;
switch (type) { switch (type) {
case "create": case "create":
args.push("--posix", "-cf", BSD_TAR_ZSTD ? tarFile : cacheFileName.replace(new RegExp(`\\${path.sep}`, "g"), "/"), "--exclude", BSD_TAR_ZSTD ? tarFile : cacheFileName.replace(new RegExp(`\\${path.sep}`, "g"), "/"), "-P", "-C", workingDirectory.replace(new RegExp(`\\${path.sep}`, "g"), "/"), "--files-from", constants_1.ManifestFilename); args.push("--posix", "-cf", BSD_TAR_ZSTD ? tarFile : cacheFileName.replace(new RegExp(`\\${path2.sep}`, "g"), "/"), "--exclude", BSD_TAR_ZSTD ? tarFile : cacheFileName.replace(new RegExp(`\\${path2.sep}`, "g"), "/"), "-P", "-C", workingDirectory.replace(new RegExp(`\\${path2.sep}`, "g"), "/"), "--files-from", constants_1.ManifestFilename);
break; break;
case "extract": case "extract":
args.push("-xf", BSD_TAR_ZSTD ? tarFile : archivePath.replace(new RegExp(`\\${path.sep}`, "g"), "/"), "-P", "-C", workingDirectory.replace(new RegExp(`\\${path.sep}`, "g"), "/")); args.push("-xf", BSD_TAR_ZSTD ? tarFile : archivePath.replace(new RegExp(`\\${path2.sep}`, "g"), "/"), "-P", "-C", workingDirectory.replace(new RegExp(`\\${path2.sep}`, "g"), "/"));
break; break;
case "list": case "list":
args.push("-tf", BSD_TAR_ZSTD ? tarFile : archivePath.replace(new RegExp(`\\${path.sep}`, "g"), "/"), "-P"); args.push("-tf", BSD_TAR_ZSTD ? tarFile : archivePath.replace(new RegExp(`\\${path2.sep}`, "g"), "/"), "-P");
break; break;
} }
if (tarPath.type === constants_1.ArchiveToolType.GNU) { if (tarPath.type === constants_1.ArchiveToolType.GNU) {
@ -58679,7 +58679,7 @@ var require_tar = __commonJS({
return BSD_TAR_ZSTD ? [ return BSD_TAR_ZSTD ? [
"zstd -d --long=30 --force -o", "zstd -d --long=30 --force -o",
constants_1.TarFilename, constants_1.TarFilename,
archivePath.replace(new RegExp(`\\${path.sep}`, "g"), "/") archivePath.replace(new RegExp(`\\${path2.sep}`, "g"), "/")
] : [ ] : [
"--use-compress-program", "--use-compress-program",
IS_WINDOWS ? '"zstd -d --long=30"' : "unzstd --long=30" IS_WINDOWS ? '"zstd -d --long=30"' : "unzstd --long=30"
@ -58688,7 +58688,7 @@ var require_tar = __commonJS({
return BSD_TAR_ZSTD ? [ return BSD_TAR_ZSTD ? [
"zstd -d --force -o", "zstd -d --force -o",
constants_1.TarFilename, constants_1.TarFilename,
archivePath.replace(new RegExp(`\\${path.sep}`, "g"), "/") archivePath.replace(new RegExp(`\\${path2.sep}`, "g"), "/")
] : ["--use-compress-program", IS_WINDOWS ? '"zstd -d"' : "unzstd"]; ] : ["--use-compress-program", IS_WINDOWS ? '"zstd -d"' : "unzstd"];
default: default:
return ["-z"]; return ["-z"];
@ -58703,7 +58703,7 @@ var require_tar = __commonJS({
case constants_1.CompressionMethod.Zstd: case constants_1.CompressionMethod.Zstd:
return BSD_TAR_ZSTD ? [ return BSD_TAR_ZSTD ? [
"zstd -T0 --long=30 --force -o", "zstd -T0 --long=30 --force -o",
cacheFileName.replace(new RegExp(`\\${path.sep}`, "g"), "/"), cacheFileName.replace(new RegExp(`\\${path2.sep}`, "g"), "/"),
constants_1.TarFilename constants_1.TarFilename
] : [ ] : [
"--use-compress-program", "--use-compress-program",
@ -58712,7 +58712,7 @@ var require_tar = __commonJS({
case constants_1.CompressionMethod.ZstdWithoutLong: case constants_1.CompressionMethod.ZstdWithoutLong:
return BSD_TAR_ZSTD ? [ return BSD_TAR_ZSTD ? [
"zstd -T0 --force -o", "zstd -T0 --force -o",
cacheFileName.replace(new RegExp(`\\${path.sep}`, "g"), "/"), cacheFileName.replace(new RegExp(`\\${path2.sep}`, "g"), "/"),
constants_1.TarFilename constants_1.TarFilename
] : ["--use-compress-program", IS_WINDOWS ? '"zstd -T0"' : "zstdmt"]; ] : ["--use-compress-program", IS_WINDOWS ? '"zstd -T0"' : "zstdmt"];
default: default:
@ -58752,7 +58752,7 @@ var require_tar = __commonJS({
exports.extractTar = extractTar; exports.extractTar = extractTar;
function createTar(archiveFolder, sourceDirectories, compressionMethod) { function createTar(archiveFolder, sourceDirectories, compressionMethod) {
return __awaiter2(this, void 0, void 0, function* () { return __awaiter2(this, void 0, void 0, function* () {
(0, fs_1.writeFileSync)(path.join(archiveFolder, constants_1.ManifestFilename), sourceDirectories.join("\n")); (0, fs_1.writeFileSync)(path2.join(archiveFolder, constants_1.ManifestFilename), sourceDirectories.join("\n"));
const commands = yield getCommands(compressionMethod, "create"); const commands = yield getCommands(compressionMethod, "create");
yield execCommands(commands, archiveFolder); yield execCommands(commands, archiveFolder);
}); });
@ -58827,7 +58827,7 @@ var require_cache = __commonJS({
Object.defineProperty(exports, "__esModule", { value: true }); Object.defineProperty(exports, "__esModule", { value: true });
exports.saveCache = exports.restoreCache = exports.isFeatureAvailable = exports.ReserveCacheError = exports.ValidationError = void 0; exports.saveCache = exports.restoreCache = exports.isFeatureAvailable = exports.ReserveCacheError = exports.ValidationError = void 0;
var core = __importStar2(require_core()); var core = __importStar2(require_core());
var path = __importStar2(require("path")); var path2 = __importStar2(require("path"));
var utils = __importStar2(require_cacheUtils()); var utils = __importStar2(require_cacheUtils());
var cacheHttpClient = __importStar2(require_cacheHttpClient()); var cacheHttpClient = __importStar2(require_cacheHttpClient());
var tar_1 = require_tar(); var tar_1 = require_tar();
@ -58892,7 +58892,7 @@ var require_cache = __commonJS({
core.info("Lookup only - skipping download"); core.info("Lookup only - skipping download");
return cacheEntry.cacheKey; return cacheEntry.cacheKey;
} }
archivePath = path.join(yield utils.createTempDirectory(), utils.getCacheFileName(compressionMethod)); archivePath = path2.join(yield utils.createTempDirectory(), utils.getCacheFileName(compressionMethod));
core.debug(`Archive Path: ${archivePath}`); core.debug(`Archive Path: ${archivePath}`);
yield cacheHttpClient.downloadCache(cacheEntry.archiveLocation, archivePath, options); yield cacheHttpClient.downloadCache(cacheEntry.archiveLocation, archivePath, options);
if (core.isDebug()) { if (core.isDebug()) {
@ -58935,7 +58935,7 @@ var require_cache = __commonJS({
throw new Error(`Path Validation Error: Path(s) specified in the action for caching do(es) not exist, hence no cache is being saved.`); throw new Error(`Path Validation Error: Path(s) specified in the action for caching do(es) not exist, hence no cache is being saved.`);
} }
const archiveFolder = yield utils.createTempDirectory(); const archiveFolder = yield utils.createTempDirectory();
const archivePath = path.join(archiveFolder, utils.getCacheFileName(compressionMethod)); const archivePath = path2.join(archiveFolder, utils.getCacheFileName(compressionMethod));
core.debug(`Archive Path: ${archivePath}`); core.debug(`Archive Path: ${archivePath}`);
try { try {
yield (0, tar_1.createTar)(archiveFolder, cachePaths, compressionMethod); yield (0, tar_1.createTar)(archiveFolder, cachePaths, compressionMethod);
@ -59005,13 +59005,13 @@ var setup_default = async (options) => {
const cacheEnabled = cacheKey && cache.isFeatureAvailable(); const cacheEnabled = cacheKey && cache.isFeatureAvailable();
const dir = (0, import_node_path.join)((0, import_node_os.homedir)(), ".bun", "bin"); const dir = (0, import_node_path.join)((0, import_node_os.homedir)(), ".bun", "bin");
action.addPath(dir); action.addPath(dir);
const path = (0, import_node_path.join)(dir, "bun"); const path2 = (0, import_node_path.join)(dir, "bun");
let revision; let revision;
let cacheHit = false; let cacheHit = false;
if (cacheEnabled) { if (cacheEnabled) {
const cacheRestored = await (0, import_cache.restoreCache)([path], cacheKey); const cacheRestored = await (0, import_cache.restoreCache)([path2], cacheKey);
if (cacheRestored) { if (cacheRestored) {
revision = await verifyBun(path); revision = await verifyBun(path2);
if (revision) { if (revision) {
cacheHit = true; cacheHit = true;
action.info("Using a cached version of Bun."); action.info("Using a cached version of Bun.");
@ -59028,12 +59028,12 @@ var setup_default = async (options) => {
const extractedPath = await (0, import_tool_cache.extractZip)(zipPath); const extractedPath = await (0, import_tool_cache.extractZip)(zipPath);
const exePath = await extractBun(extractedPath); const exePath = await extractBun(extractedPath);
await (0, import_io.mkdirP)(dir); await (0, import_io.mkdirP)(dir);
await (0, import_io.cp)(exePath, path); await (0, import_io.cp)(exePath, path2);
await (0, import_io.rmRF)(exePath); await (0, import_io.rmRF)(exePath);
revision = await verifyBun(path); revision = await verifyBun(path2);
} }
try { try {
await (0, import_promises.symlink)(path, (0, import_node_path.join)(dir, "bunx")); await (0, import_promises.symlink)(path2, (0, import_node_path.join)(dir, "bunx"));
} catch (error) { } catch (error) {
if (error.code !== "EEXIST") { if (error.code !== "EEXIST") {
throw error; throw error;
@ -59046,7 +59046,7 @@ var setup_default = async (options) => {
} }
if (cacheEnabled) { if (cacheEnabled) {
try { try {
await (0, import_cache.saveCache)([path], cacheKey); await (0, import_cache.saveCache)([path2], cacheKey);
} catch (error) { } catch (error) {
action.warning("Failed to save Bun to cache."); action.warning("Failed to save Bun to cache.");
} }
@ -59079,10 +59079,10 @@ function getDownloadUrl(options) {
cacheKey: /^latest|canary|action/i.test(release) ? null : `bun-${release}-${os}-${arch}-${avx2}-${profile}` cacheKey: /^latest|canary|action/i.test(release) ? null : `bun-${release}-${os}-${arch}-${avx2}-${profile}`
}; };
} }
async function extractBun(path) { async function extractBun(path2) {
for (const entry of await (0, import_promises.readdir)(path, { withFileTypes: true })) { for (const entry of await (0, import_promises.readdir)(path2, { withFileTypes: true })) {
const { name } = entry; const { name } = entry;
const entryPath = (0, import_node_path.join)(path, name); const entryPath = (0, import_node_path.join)(path2, name);
if (entry.isFile()) { if (entry.isFile()) {
if (name === "bun") { if (name === "bun") {
return entryPath; return entryPath;
@ -59098,14 +59098,14 @@ async function extractBun(path) {
} }
throw new Error("Could not find executable: bun"); throw new Error("Could not find executable: bun");
} }
async function verifyBun(path) { async function verifyBun(path2) {
const revision = await (0, import_exec.getExecOutput)(path, ["--revision"], { const revision = await (0, import_exec.getExecOutput)(path2, ["--revision"], {
ignoreReturnCode: true ignoreReturnCode: true
}); });
if (revision.exitCode === 0 && /^\d+\.\d+\.\d+/.test(revision.stdout)) { if (revision.exitCode === 0 && /^\d+\.\d+\.\d+/.test(revision.stdout)) {
return revision.stdout.trim(); return revision.stdout.trim();
} }
const version3 = await (0, import_exec.getExecOutput)(path, ["--version"], { const version3 = await (0, import_exec.getExecOutput)(path2, ["--version"], {
ignoreReturnCode: true ignoreReturnCode: true
}); });
if (version3.exitCode === 0 && /^\d+\.\d+\.\d+/.test(version3.stdout)) { if (version3.exitCode === 0 && /^\d+\.\d+\.\d+/.test(version3.stdout)) {
@ -59115,11 +59115,27 @@ async function verifyBun(path) {
} }
// src/action.ts // src/action.ts
var import_fs = require("fs");
var path = __toESM(require("path"));
if (!process.env.RUNNER_TEMP) { if (!process.env.RUNNER_TEMP) {
process.env.RUNNER_TEMP = (0, import_node_os2.tmpdir)(); process.env.RUNNER_TEMP = (0, import_node_os2.tmpdir)();
} }
function readVersionFromPackageJson() {
const { GITHUB_WORKSPACE } = process.env;
if (!GITHUB_WORKSPACE) {
return;
}
const pathToPackageJson = path.join(GITHUB_WORKSPACE, "package.json");
if (!(0, import_fs.existsSync)(pathToPackageJson)) {
return;
}
const { packageManager } = JSON.parse(
(0, import_fs.readFileSync)(pathToPackageJson, "utf8")
);
return packageManager == null ? void 0 : packageManager.split("bun@")[1];
}
setup_default({ setup_default({
version: action2.getInput("bun-version") || void 0, version: readVersionFromPackageJson() || action2.getInput("bun-version") || void 0,
customUrl: action2.getInput("bun-download-url") || void 0 customUrl: action2.getInput("bun-download-url") || void 0
}).then(({ version: version3, revision, cacheHit }) => { }).then(({ version: version3, revision, cacheHit }) => {
action2.setOutput("bun-version", version3); action2.setOutput("bun-version", version3);

View File

@ -30,6 +30,7 @@
"@actions/tool-cache": "^2.0.1" "@actions/tool-cache": "^2.0.1"
}, },
"devDependencies": { "devDependencies": {
"@types/node": "^20.8.2",
"esbuild": "^0.19.2", "esbuild": "^0.19.2",
"prettier": "^2.8.4", "prettier": "^2.8.4",
"typescript": "^4.9.5" "typescript": "^4.9.5"

View File

@ -1,13 +1,31 @@
import { tmpdir } from "node:os"; import { tmpdir } from "node:os";
import * as action from "@actions/core"; import * as action from "@actions/core";
import setup from "./setup.js"; import setup from "./setup.js";
import { existsSync, readFileSync } from "fs";
import * as path from "path";
if (!process.env.RUNNER_TEMP) { if (!process.env.RUNNER_TEMP) {
process.env.RUNNER_TEMP = tmpdir(); process.env.RUNNER_TEMP = tmpdir();
} }
function readVersionFromPackageJson(): string | undefined {
const { GITHUB_WORKSPACE } = process.env;
if (!GITHUB_WORKSPACE) {
return;
}
const pathToPackageJson = path.join(GITHUB_WORKSPACE, "package.json");
if (!existsSync(pathToPackageJson)) {
return;
}
const { packageManager } = JSON.parse(
readFileSync(pathToPackageJson, "utf8")
) as { packageManager?: string };
return packageManager?.split("bun@")[1];
}
setup({ setup({
version: action.getInput("bun-version") || undefined, version:
readVersionFromPackageJson() || action.getInput("bun-version") || undefined,
customUrl: action.getInput("bun-download-url") || undefined, customUrl: action.getInput("bun-download-url") || undefined,
}) })
.then(({ version, revision, cacheHit }) => { .then(({ version, revision, cacheHit }) => {