mirror of
https://github.com/ruby/setup-ruby.git
synced 2026-09-13 22:44:20 +02:00
Add a self-hosted input to force considering the current runner as self-hosted
* Since checking for self-hosted is based on guessing as there is no proper predicate for it in GitHub Actions (AFAIK).
This commit is contained in:
+14
-2
@@ -296,6 +296,7 @@ __nccwpck_require__.d(__webpack_exports__, {
|
||||
"getVirtualEnvironmentName": () => (/* binding */ getVirtualEnvironmentName),
|
||||
"hasBundlerDefaultGem": () => (/* binding */ hasBundlerDefaultGem),
|
||||
"hashFile": () => (/* binding */ hashFile),
|
||||
"inputs": () => (/* binding */ inputs),
|
||||
"isBundler1Default": () => (/* binding */ isBundler1Default),
|
||||
"isBundler2Default": () => (/* binding */ isBundler2Default),
|
||||
"isBundler2dot2Default": () => (/* binding */ isBundler2dot2Default),
|
||||
@@ -366,6 +367,10 @@ const windows = (os.platform() === 'win32')
|
||||
// Extract to SSD on Windows, see https://github.com/ruby/setup-ruby/pull/14
|
||||
const drive = (windows ? (process.env['GITHUB_WORKSPACE'] || 'C')[0] : undefined)
|
||||
|
||||
const inputs = {
|
||||
selfHosted: undefined
|
||||
}
|
||||
|
||||
function partition(string, separator) {
|
||||
const i = string.indexOf(separator)
|
||||
if (i === -1) {
|
||||
@@ -519,8 +524,13 @@ const GitHubHostedPlatforms = [
|
||||
// * the OS and OS version does not correspond to a GitHub-hosted runner image,
|
||||
// * or the hosted tool cache is different from the default tool cache path
|
||||
function isSelfHostedRunner() {
|
||||
return !GitHubHostedPlatforms.includes(getOSNameVersionArch()) ||
|
||||
getRunnerToolCache() !== getDefaultToolCachePath()
|
||||
if (inputs.selfHosted === undefined) {
|
||||
throw new Error('inputs.selfHosted should have been already set')
|
||||
}
|
||||
|
||||
return inputs.selfHosted === 'true' ||
|
||||
!GitHubHostedPlatforms.includes(getOSNameVersionArch()) ||
|
||||
getRunnerToolCache() !== getDefaultToolCachePath()
|
||||
}
|
||||
|
||||
let virtualEnvironmentName = undefined
|
||||
@@ -69022,6 +69032,7 @@ const inputDefaults = {
|
||||
'bundler-cache': 'false',
|
||||
'working-directory': '.',
|
||||
'cache-version': bundler.DEFAULT_CACHE_VERSION,
|
||||
'self-hosted': 'false',
|
||||
}
|
||||
|
||||
// entry point when this action is run on its own
|
||||
@@ -69045,6 +69056,7 @@ async function setupRuby(options = {}) {
|
||||
inputs[key] = core.getInput(key) || inputDefaults[key]
|
||||
}
|
||||
}
|
||||
common.inputs.selfHosted = inputs['self-hosted']
|
||||
|
||||
process.chdir(inputs['working-directory'])
|
||||
|
||||
|
||||
Reference in New Issue
Block a user