Skip to content

Commit

Permalink
Update src/setup-python.ts
Browse files Browse the repository at this point in the history
Co-authored-by: Ivan <98037481+IvanZosimov@users.noreply.github.com>
  • Loading branch information
techman83 and IvanZosimov committed Jul 23, 2022
1 parent 501a62e commit 1905a03
Showing 1 changed file with 14 additions and 8 deletions.
22 changes: 14 additions & 8 deletions src/setup-python.ts
Expand Up @@ -61,15 +61,21 @@ function resolveVersionInput(): string {
}

async function run() {
// When setting AGENT_TOOLSDIRECTORY, the actions/tool-cache function find
// is not able to find the files cached by actions/python-version.
if (process.env.AGENT_TOOLSDIRECTORY?.trim() && !IS_MAC) {
if (!process.env.AGENT_TOOLSDIRECTORY?.trim() && IS_MAC) {
process.env['AGENT_TOOLSDIRECTORY'] = '/Users/runner/hostedtoolcache';
}

if (process.env.AGENT_TOOLSDIRECTORY?.trim()){
process.env['RUNNER_TOOL_CACHE'] = process.env['AGENT_TOOLSDIRECTORY'];
} else if (process.env.AGENT_TOOLSDIRECTORY?.trim() && IS_MAC) {
process.env['AGENT_TOOLSDIRECTORY'] = process.env['RUNNER_TOOL_CACHE'];
core.warning(
'AGENT_TOOLSDIRECTORY is not valid for MacOS as shared libraries are configured with a fixed path.'
);
}

core.debug(
`Python is expected to be installed into ${
process.env.AGENT_TOOLSDIRECTORY?.trim()
? process.env['AGENT_TOOLSDIRECTORY']
: process.env['RUNNER_TOOL_CACHE']
}`
);
}
core.debug(
`Python is expected to be installed into RUNNER_TOOL_CACHE=${process.env['RUNNER_TOOL_CACHE']}`
Expand Down

0 comments on commit 1905a03

Please sign in to comment.