Skip to content

Commit

Permalink
This fixes the tool cache path for self-hosted runners, along
Browse files Browse the repository at this point in the history
with handling AGENT_TOOLSDIRECTORY for both hosted + self-hosted.

    Fixes actions#459
  • Loading branch information
techman83 committed Jul 18, 2022
1 parent 05e2d60 commit a1b3b10
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 10 deletions.
9 changes: 4 additions & 5 deletions dist/setup/index.js
Expand Up @@ -65278,11 +65278,10 @@ function resolveVersionInput() {
function run() {
var _a;
return __awaiter(this, void 0, void 0, function* () {
// This aligns us with actions/setup-python, which defaults their
// internal TOOLCACHE_ROOT to RUNNER_TOOL_CACHE when AGENT_TOOLSDIRECTORY
// is not set.
if (!((_a = process.env.AGENT_TOOLSDIRECTORY) === null || _a === void 0 ? void 0 : _a.trim())) {
process.env['AGENT_TOOLSDIRECTORY'] = process.env['RUNNER_TOOL_CACHE'];
// When setting AGENT_TOOLSDIRECTORY, the actions/tool-cache function find
// is not able to find the files cached by actions/python-version.
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 RUNNER_TOOL_CACHE=${process.env['RUNNER_TOOL_CACHE']}`);
try {
Expand Down
9 changes: 4 additions & 5 deletions src/setup-python.ts
Expand Up @@ -61,11 +61,10 @@ function resolveVersionInput(): string {
}

async function run() {
// This aligns us with actions/setup-python, which defaults their
// internal TOOLCACHE_ROOT to RUNNER_TOOL_CACHE when AGENT_TOOLSDIRECTORY
// is not set.
if (!process.env.AGENT_TOOLSDIRECTORY?.trim()) {
process.env['AGENT_TOOLSDIRECTORY'] = process.env['RUNNER_TOOL_CACHE'];
// 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()) {
process.env['RUNNER_TOOL_CACHE'] = process.env['AGENT_TOOLSDIRECTORY'];
}
core.debug(
`Python is expected to be installed into RUNNER_TOOL_CACHE=${process.env['RUNNER_TOOL_CACHE']}`
Expand Down

0 comments on commit a1b3b10

Please sign in to comment.