mirror of
https://github.com/ruby/setup-ruby.git
synced 2026-09-13 14:34:21 +02:00
Use tc.find() with the effective tool cache path
* So it finds already-download prebuilt Ruby in the GH-hosted tool cache path on self-hosted, where $RUNNER_TOOL_CACHE is often different than on GH-hosted. * See #475. * This relies on tc.find() looking up the env var every time: https://github.com/actions/toolkit/blob/1f4b3fac06/packages/tool-cache/src/tool-cache.ts#L522
This commit is contained in:
@@ -5,6 +5,7 @@ const util = require('util')
|
||||
const stream = require('stream')
|
||||
const crypto = require('crypto')
|
||||
const core = require('@actions/core')
|
||||
const tc = require('@actions/tool-cache')
|
||||
const { performance } = require('perf_hooks')
|
||||
const linuxOSInfo = require('linux-os-info')
|
||||
import macosRelease from 'macos-release'
|
||||
@@ -264,7 +265,18 @@ function getDefaultToolCachePath() {
|
||||
}
|
||||
}
|
||||
|
||||
export function engineToToolCacheName(engine) {
|
||||
// tc.find() but using RUNNER_TOOL_CACHE=getToolCachePath()
|
||||
export function toolCacheFind(engine, version) {
|
||||
const originalToolCache = getToolCachePath()
|
||||
process.env['RUNNER_TOOL_CACHE'] = getToolCachePath()
|
||||
try {
|
||||
return tc.find(engineToToolCacheName(engine), version)
|
||||
} finally {
|
||||
process.env['RUNNER_TOOL_CACHE'] = originalToolCache
|
||||
}
|
||||
}
|
||||
|
||||
function engineToToolCacheName(engine) {
|
||||
return {
|
||||
ruby: 'Ruby',
|
||||
jruby: 'JRuby',
|
||||
|
||||
Reference in New Issue
Block a user