Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: don't override AGENT_TOOLSDIRECTORY if it's not needed #564

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
20 changes: 11 additions & 9 deletions dist/setup/index.js
Expand Up @@ -66896,21 +66896,23 @@ function resolveVersionInput() {
function run() {
var _a;
return __awaiter(this, void 0, void 0, function* () {
if (utils_1.IS_MAC) {
process.env['AGENT_TOOLSDIRECTORY'] = '/Users/runner/hostedtoolcache';
}
if ((_a = process.env.AGENT_TOOLSDIRECTORY) === null || _a === void 0 ? void 0 : _a.trim()) {
process.env['RUNNER_TOOL_CACHE'] = process.env['AGENT_TOOLSDIRECTORY'];
}
core.debug(`Python is expected to be installed into ${process.env['RUNNER_TOOL_CACHE']}`);
try {
const version = resolveVersionInput();
const checkLatest = core.getBooleanInput('check-latest');
if (version) {
let pythonVersion;
const arch = core.getInput('architecture') || os.arch();
const updateEnvironment = core.getBooleanInput('update-environment');
if (isPyPyVersion(version)) {
const checkLatest = core.getBooleanInput('check-latest');
const isPyPy = isPyPyVersion(version);
const forceMacToolsDirectory = utils_1.IS_MAC && !isPyPy && arch === 'x64';
if (forceMacToolsDirectory) {
process.env['AGENT_TOOLSDIRECTORY'] = '/Users/runner/hostedtoolcache';
}
if ((_a = process.env.AGENT_TOOLSDIRECTORY) === null || _a === void 0 ? void 0 : _a.trim()) {
process.env['RUNNER_TOOL_CACHE'] = process.env['AGENT_TOOLSDIRECTORY'];
}
core.debug(`Python is expected to be installed into ${process.env['RUNNER_TOOL_CACHE']}`);
if (isPyPy) {
const installed = yield finderPyPy.findPyPyVersion(version, arch, updateEnvironment, checkLatest);
pythonVersion = `${installed.resolvedPyPyVersion}-${installed.resolvedPythonVersion}`;
core.info(`Successfully set up PyPy ${installed.resolvedPyPyVersion} with Python (${installed.resolvedPythonVersion})`);
Expand Down
30 changes: 17 additions & 13 deletions src/setup-python.ts
Expand Up @@ -63,26 +63,30 @@ function resolveVersionInput(): string {
}

async function run() {
if (IS_MAC) {
process.env['AGENT_TOOLSDIRECTORY'] = '/Users/runner/hostedtoolcache';
}

if (process.env.AGENT_TOOLSDIRECTORY?.trim()) {
process.env['RUNNER_TOOL_CACHE'] = process.env['AGENT_TOOLSDIRECTORY'];
}

core.debug(
`Python is expected to be installed into ${process.env['RUNNER_TOOL_CACHE']}`
);
try {
const version = resolveVersionInput();
const checkLatest = core.getBooleanInput('check-latest');

if (version) {
let pythonVersion: string;
const arch: string = core.getInput('architecture') || os.arch();
const updateEnvironment = core.getBooleanInput('update-environment');
if (isPyPyVersion(version)) {
const checkLatest = core.getBooleanInput('check-latest');
const isPyPy = isPyPyVersion(version);
const forceMacToolsDirectory = IS_MAC && !isPyPy && arch === 'x64';

if (forceMacToolsDirectory) {
process.env['AGENT_TOOLSDIRECTORY'] = '/Users/runner/hostedtoolcache';
}

if (process.env.AGENT_TOOLSDIRECTORY?.trim()) {
process.env['RUNNER_TOOL_CACHE'] = process.env['AGENT_TOOLSDIRECTORY'];
}

core.debug(
`Python is expected to be installed into ${process.env['RUNNER_TOOL_CACHE']}`
);

if (isPyPy) {
const installed = await finderPyPy.findPyPyVersion(
version,
arch,
Expand Down