From d28defba5ef1e23d3113633372f358116533dcd8 Mon Sep 17 00:00:00 2001 From: Manas Jayanth <3097018+ManasJayanth@users.noreply.github.com> Date: Sat, 13 Jul 2024 14:34:57 +0530 Subject: [PATCH] initialise esyPrefix early on --- dist/index.js | 22 +++++++++++----------- index.ts | 33 ++++++++++++++++----------------- 2 files changed, 27 insertions(+), 28 deletions(-) diff --git a/dist/index.js b/dist/index.js index c18ae17..d99f2ce 100644 --- a/dist/index.js +++ b/dist/index.js @@ -180477,6 +180477,17 @@ function main() { return __awaiter(this, void 0, void 0, function* () { const workingDirectory = core.getInput("working-directory") || process.cwd(); try { + esyPrefix = + esyPrefix && esyPrefix !== "" + ? esyPrefix + : external_path_.join(external_path_.dirname(process.env.GITHUB_WORKSPACE || + process.env.HOME || + process.env.HOMEPATH || + "~"), ".esy"); + console.log("esy-prefix", esyPrefix); + const ghOutputEsyPrefixK = "ESY_PREFIX"; + console.log(`Setting ${ghOutputEsyPrefixK} to`, esyPrefix); + appendEnvironmentFile(ghOutputEsyPrefixK, esyPrefix); if (setupEsy) { let tarballUrl, checksum, esyPackageVersion, esyPackageName; if (!setupEsyVersion || !setupEsyShaSum || !setupEsyTarball) { @@ -180520,17 +180531,6 @@ function main() { } external_fs_.statSync(workingDirectory); process.chdir(workingDirectory); - esyPrefix = - esyPrefix && esyPrefix !== "" - ? esyPrefix - : external_path_.join(external_path_.dirname(process.env.GITHUB_WORKSPACE || - process.env.HOME || - process.env.HOMEPATH || - "~"), ".esy"); - console.log("esy-prefix", esyPrefix); - const ghOutputEsyPrefixK = "ESY_PREFIX"; - console.log(`Setting ${ghOutputEsyPrefixK} to`, esyPrefix); - appendEnvironmentFile(ghOutputEsyPrefixK, esyPrefix); const installPath = [`${esyPrefix}/source`]; const installKey = `source-${index_platform}-${arch}-${sourceCacheKey}`; core.startGroup("Restoring install cache"); diff --git a/index.ts b/index.ts index 71974d9..6b06d0b 100644 --- a/index.ts +++ b/index.ts @@ -121,6 +121,22 @@ const arch = os.arch(); async function main() { const workingDirectory = core.getInput("working-directory") || process.cwd(); try { + esyPrefix = + esyPrefix && esyPrefix !== "" + ? esyPrefix + : path.join( + path.dirname( + process.env.GITHUB_WORKSPACE || + process.env.HOME || + process.env.HOMEPATH || + "~" + ), + ".esy" + ); + console.log("esy-prefix", esyPrefix); + const ghOutputEsyPrefixK = "ESY_PREFIX"; + console.log(`Setting ${ghOutputEsyPrefixK} to`, esyPrefix); + appendEnvironmentFile(ghOutputEsyPrefixK, esyPrefix); if (setupEsy) { let tarballUrl, checksum, esyPackageVersion, esyPackageName; if (!setupEsyVersion || !setupEsyShaSum || !setupEsyTarball) { @@ -182,23 +198,6 @@ async function main() { } fs.statSync(workingDirectory); process.chdir(workingDirectory); - - esyPrefix = - esyPrefix && esyPrefix !== "" - ? esyPrefix - : path.join( - path.dirname( - process.env.GITHUB_WORKSPACE || - process.env.HOME || - process.env.HOMEPATH || - "~" - ), - ".esy" - ); - console.log("esy-prefix", esyPrefix); - const ghOutputEsyPrefixK = "ESY_PREFIX"; - console.log(`Setting ${ghOutputEsyPrefixK} to`, esyPrefix); - appendEnvironmentFile(ghOutputEsyPrefixK, esyPrefix); const installPath = [`${esyPrefix}/source`]; const installKey = `source-${platform}-${arch}-${sourceCacheKey}`; core.startGroup("Restoring install cache");