Title: fix: respect pre-existing AGENT_TOOLSDIRECTORY on macOS self-hosted runners by dahai80 · Pull Request #1387 · actions/setup-python · GitHub
Open Graph Title: fix: respect pre-existing AGENT_TOOLSDIRECTORY on macOS self-hosted runners by dahai80 · Pull Request #1387 · actions/setup-python
X Title: fix: respect pre-existing AGENT_TOOLSDIRECTORY on macOS self-hosted runners by dahai80 · Pull Request #1387 · actions/setup-python
Description: Summary On macOS the action unconditionally overwrites AGENT_TOOLSDIRECTORY with the hosted-images default /Users/runner/hostedtoolcache: src/setup-python.ts: if (IS_MAC) { process.env['AGENT_TOOLSDIRECTORY'] = '/Users/runner/hostedtoolcache'; } Self-hosted macOS runners export their own AGENT_TOOLSDIRECTORY / RUNNER_TOOL_CACHE in the runner service environment. The hardcode discards both, so the downloaded setup.sh runs mkdir -p /Users/runner/hostedtoolcache and fails with mkdir: /Users/runner: Permission denied on hosts that have no runner user account. Reproduction Self-hosted macOS runner with RUNNER_TOOL_CACHE/AGENT_TOOLSDIRECTORY exported via the service wrapper (verified present in both bash and node step env), any actions/setup-python@v7 step that needs to download a Python version fails at the archive's install script: Version 3.11 was not found in the local cache Download from .../python-3.11.9-darwin-arm64.tar.gz Execute installation script Check if Python hostedtoolcache folder exist... Creating Python hostedtoolcache folder... ##[error]mkdir: /Users/runner: Permission denied Change Fall back to /Users/runner/hostedtoolcache only when the runner did not provide a non-empty AGENT_TOOLSDIRECTORY. Behavior on GitHub-hosted macOS images is unchanged (they set AGENT_TOOLSDIRECTORY=/Users/runner/hostedtoolcache explicitly or the fallback applies identically). Validation Self-hosted macOS runner (Apple Silicon, macOS 26) with RUNNER_TOOL_CACHE/AGENT_TOOLSDIRECTORY pointing to a writable custom dir: previously every setup-python step failed with the mkdir error above; with the patched action logic the same step resolves the install dir from the runner-provided path. Hosted macOS behavior: AGENT_TOOLSDIRECTORY is either pre-set by the image (unchanged) or the fallback applies (identical to current behavior). Fixes #914 (macOS variant; the Linux /opt/hostedtoolcache symptom reported there has a separate code path) 🤖 Generated with Claude Code
Open Graph Description: Summary On macOS the action unconditionally overwrites AGENT_TOOLSDIRECTORY with the hosted-images default /Users/runner/hostedtoolcache: src/setup-python.ts: if (IS_MAC) { process.env['AGENT...
X Description: Summary On macOS the action unconditionally overwrites AGENT_TOOLSDIRECTORY with the hosted-images default /Users/runner/hostedtoolcache: src/setup-python.ts: if (IS_MAC) { process.env['A...
Opengraph URL: https://github.com/actions/setup-python/pull/1387
X: @github
Domain: github.com
| react-profiling | 0 |
| react-import-map | react,react-dom,react-dom/client,react-dom/profiling,react-is,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@b8488ee2c322 |
| route-pattern | /:user_id/:repository/pull/:id/files(.:format) |
| route-controller | pull_requests |
| route-action | files |
| fetch-nonce | v2:9f5b0f3b-1863-0f04-1e30-c9455c425fa7 |
| current-catalog-service-hash | ae870bc5e265a340912cde392f23dad3671a0a881730ffdadd82f2f57d81641b |
| request-id | A21A:1DC474:5E0885:7C5479:6B0268B0 |
| html-safe-nonce | a36d123af452f1f4e8b7d9c166629877083df0cf95ccfbe0fa18627df5093219 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJBMjFBOjFEQzQ3NDo1RTA4ODU6N0M1NDc5OjZCMDI2OEIwIiwidmlzaXRvcl9pZCI6IjYxNzk1MzQ0NjI2NDExMzc4NDAiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ== |
| visitor-hmac | c9e594d950044100a8b4f93c6955079f78252701a0392619e01c62d89f1e76ee |
| hovercard-subject-tag | pull_request:5303289289 |
| github-keyboard-shortcuts | repository,pull-request-list,pull-request-conversation,pull-request-files-changed,actions,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/actions/setup-python/pull/1387/files |
| twitter:image | https://avatars.githubusercontent.com/u/29432441?s=400&v=4 |
| twitter:card | summary_large_image |
| og:image | https://avatars.githubusercontent.com/u/29432441?s=400&v=4 |
| og:image:alt | Summary On macOS the action unconditionally overwrites AGENT_TOOLSDIRECTORY with the hosted-images default /Users/runner/hostedtoolcache: src/setup-python.ts: if (IS_MAC) { process.env['AGENT... |
| og:site_name | GitHub |
| og:type | object |
| hostname | github.com |
| expected-hostname | github.com |
| None | 87e774ee7c6b3bee0490394e4d3e57ec9dbc956f74b87ea685dc8996c1676456 |
| turbo-cache-control | no-preview |
| diff-view | unified |
| go-import | github.com/actions/setup-python git https://github.com/actions/setup-python.git |
| octolytics-dimension-user_id | 44036562 |
| octolytics-dimension-user_login | actions |
| octolytics-dimension-repository_id | 192625525 |
| octolytics-dimension-repository_nwo | actions/setup-python |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 192625525 |
| octolytics-dimension-repository_network_root_nwo | actions/setup-python |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | true |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 423dbb54c5e7bfecc838eb387c1435eb3d0e760d |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width