From 3250b5373c88720a0abe3102db9b62c9b12b3f1a Mon Sep 17 00:00:00 2001 From: Sergey Dolin Date: Thu, 17 Feb 2022 18:35:19 +0000 Subject: [PATCH 1/3] Force RUNNER_TOOL_CACHE to be equal AGENT_TOOLSDIRECTORY --- dist/setup/index.js | 7 +++++++ src/setup-python.ts | 7 +++++++ 2 files changed, 14 insertions(+) diff --git a/dist/setup/index.js b/dist/setup/index.js index a742d5880..8c0f675dd 100644 --- a/dist/setup/index.js +++ b/dist/setup/index.js @@ -6645,6 +6645,13 @@ function cacheDependencies(cache, pythonVersion) { } function run() { return __awaiter(this, void 0, void 0, function* () { + if (process.env['AGENT_TOOLSDIRECTORY'] !== undefined) { + core.debug('Python is expected to be installed into AGENT_TOOLSDIRECTORY=' + process.env['AGENT_TOOLSDIRECTORY']); + process.env['RUNNER_TOOL_CACHE'] = process.env['AGENT_TOOLSDIRECTORY']; + } + else { + core.debug('Python is expected to be installed into RUNNER_TOOL_CACHE=' + process.env['RUNNER_TOOL_CACHE']); + } try { const version = core.getInput('python-version'); if (version) { diff --git a/src/setup-python.ts b/src/setup-python.ts index 3a19efe13..9b1fd353f 100644 --- a/src/setup-python.ts +++ b/src/setup-python.ts @@ -25,6 +25,13 @@ async function cacheDependencies(cache: string, pythonVersion: string) { } async function run() { + + if (process.env['AGENT_TOOLSDIRECTORY'] !== undefined) { + core.debug('Python is expected to be installed into AGENT_TOOLSDIRECTORY=' + process.env['AGENT_TOOLSDIRECTORY'] ) + process.env['RUNNER_TOOL_CACHE'] = process.env['AGENT_TOOLSDIRECTORY'] + } else { + core.debug('Python is expected to be installed into RUNNER_TOOL_CACHE=' + process.env['RUNNER_TOOL_CACHE'] ) + } try { const version = core.getInput('python-version'); if (version) { From 011c443f81da0c48c2615561093cc440facf4311 Mon Sep 17 00:00:00 2001 From: Sergey Dolin Date: Thu, 17 Feb 2022 19:21:13 +0000 Subject: [PATCH 2/3] prettier --- dist/setup/index.js | 6 ++++-- src/setup-python.ts | 13 +++++++++---- 2 files changed, 13 insertions(+), 6 deletions(-) diff --git a/dist/setup/index.js b/dist/setup/index.js index 8c0f675dd..054cb7294 100644 --- a/dist/setup/index.js +++ b/dist/setup/index.js @@ -6646,11 +6646,13 @@ function cacheDependencies(cache, pythonVersion) { function run() { return __awaiter(this, void 0, void 0, function* () { if (process.env['AGENT_TOOLSDIRECTORY'] !== undefined) { - core.debug('Python is expected to be installed into AGENT_TOOLSDIRECTORY=' + process.env['AGENT_TOOLSDIRECTORY']); + core.debug('Python is expected to be installed into AGENT_TOOLSDIRECTORY=' + + process.env['AGENT_TOOLSDIRECTORY']); process.env['RUNNER_TOOL_CACHE'] = process.env['AGENT_TOOLSDIRECTORY']; } else { - core.debug('Python is expected to be installed into RUNNER_TOOL_CACHE=' + process.env['RUNNER_TOOL_CACHE']); + core.debug('Python is expected to be installed into RUNNER_TOOL_CACHE=' + + process.env['RUNNER_TOOL_CACHE']); } try { const version = core.getInput('python-version'); diff --git a/src/setup-python.ts b/src/setup-python.ts index 9b1fd353f..6022b2ea2 100644 --- a/src/setup-python.ts +++ b/src/setup-python.ts @@ -25,12 +25,17 @@ async function cacheDependencies(cache: string, pythonVersion: string) { } async function run() { - if (process.env['AGENT_TOOLSDIRECTORY'] !== undefined) { - core.debug('Python is expected to be installed into AGENT_TOOLSDIRECTORY=' + process.env['AGENT_TOOLSDIRECTORY'] ) - process.env['RUNNER_TOOL_CACHE'] = process.env['AGENT_TOOLSDIRECTORY'] + core.debug( + 'Python is expected to be installed into AGENT_TOOLSDIRECTORY=' + + process.env['AGENT_TOOLSDIRECTORY'] + ); + process.env['RUNNER_TOOL_CACHE'] = process.env['AGENT_TOOLSDIRECTORY']; } else { - core.debug('Python is expected to be installed into RUNNER_TOOL_CACHE=' + process.env['RUNNER_TOOL_CACHE'] ) + core.debug( + 'Python is expected to be installed into RUNNER_TOOL_CACHE=' + + process.env['RUNNER_TOOL_CACHE'] + ); } try { const version = core.getInput('python-version'); From 65fe6a82c70776c8d39cb6ec21b08db2c4a6fe24 Mon Sep 17 00:00:00 2001 From: Sergey Dolin Date: Mon, 21 Feb 2022 05:23:19 +0000 Subject: [PATCH 3/3] Use template literals instead of string concatenation --- dist/setup/index.js | 9 ++++----- src/setup-python.ts | 8 +++----- 2 files changed, 7 insertions(+), 10 deletions(-) diff --git a/dist/setup/index.js b/dist/setup/index.js index 054cb7294..6a21eb39e 100644 --- a/dist/setup/index.js +++ b/dist/setup/index.js @@ -6644,15 +6644,14 @@ function cacheDependencies(cache, pythonVersion) { }); } function run() { + var _a; return __awaiter(this, void 0, void 0, function* () { - if (process.env['AGENT_TOOLSDIRECTORY'] !== undefined) { - core.debug('Python is expected to be installed into AGENT_TOOLSDIRECTORY=' + - process.env['AGENT_TOOLSDIRECTORY']); + if ((_a = process.env.AGENT_TOOLSDIRECTORY) === null || _a === void 0 ? void 0 : _a.trim()) { + core.debug(`Python is expected to be installed into AGENT_TOOLSDIRECTORY=${process.env['AGENT_TOOLSDIRECTORY']}`); process.env['RUNNER_TOOL_CACHE'] = process.env['AGENT_TOOLSDIRECTORY']; } else { - core.debug('Python is expected to be installed into RUNNER_TOOL_CACHE=' + - process.env['RUNNER_TOOL_CACHE']); + core.debug(`Python is expected to be installed into RUNNER_TOOL_CACHE==${process.env['RUNNER_TOOL_CACHE']}`); } try { const version = core.getInput('python-version'); diff --git a/src/setup-python.ts b/src/setup-python.ts index 6022b2ea2..ed2dd2588 100644 --- a/src/setup-python.ts +++ b/src/setup-python.ts @@ -25,16 +25,14 @@ async function cacheDependencies(cache: string, pythonVersion: string) { } async function run() { - if (process.env['AGENT_TOOLSDIRECTORY'] !== undefined) { + if (process.env.AGENT_TOOLSDIRECTORY?.trim()) { core.debug( - 'Python is expected to be installed into AGENT_TOOLSDIRECTORY=' + - process.env['AGENT_TOOLSDIRECTORY'] + `Python is expected to be installed into AGENT_TOOLSDIRECTORY=${process.env['AGENT_TOOLSDIRECTORY']}` ); process.env['RUNNER_TOOL_CACHE'] = process.env['AGENT_TOOLSDIRECTORY']; } else { core.debug( - 'Python is expected to be installed into RUNNER_TOOL_CACHE=' + - process.env['RUNNER_TOOL_CACHE'] + `Python is expected to be installed into RUNNER_TOOL_CACHE==${process.env['RUNNER_TOOL_CACHE']}` ); } try {