mirror of
https://github.com/actions/setup-python.git
synced 2026-11-16 22:25:06 +08:00
fix: respect pre-existing AGENT_TOOLSDIRECTORY on macOS self-hosted runners
On macOS the action unconditionally overwrites AGENT_TOOLSDIRECTORY with the hosted-images default /Users/runner/hostedtoolcache. Self-hosted macOS runners export their own AGENT_TOOLSDIRECTORY (and RUNNER_TOOL_CACHE) in the runner service environment, but the hardcode discards both, so the downloaded setup.sh attempts mkdir /Users/runner/hostedtoolcache and fails with 'Permission denied' on hosts without a 'runner' user account. Only fall back to the hosted default when the runner did not provide a non-empty AGENT_TOOLSDIRECTORY. Fixes #914 (macOS variant) Co-Authored-By: Claude Code <noreply@anthropic.com>
This commit is contained in:
parent
90485b7ad2
commit
be4c7f1c4e
1 changed files with 6 additions and 1 deletions
|
|
@ -94,7 +94,12 @@ function resolveVersionInput() {
|
|||
}
|
||||
|
||||
async function run() {
|
||||
if (IS_MAC) {
|
||||
if (IS_MAC && !process.env.AGENT_TOOLSDIRECTORY?.trim()) {
|
||||
// Default to the hosted-images location only when the runner did not
|
||||
// provide one. Self-hosted macOS runners export their own
|
||||
// AGENT_TOOLSDIRECTORY; overwriting it unconditionally makes the action
|
||||
// mkdir /Users/runner/hostedtoolcache, which fails on hosts where the
|
||||
// `runner` user does not exist (#914).
|
||||
process.env['AGENT_TOOLSDIRECTORY'] = '/Users/runner/hostedtoolcache';
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue