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:
@@ -13,6 +13,10 @@ export const windows = (os.platform() === 'win32')
|
||||
// Extract to SSD on Windows, see https://github.com/ruby/setup-ruby/pull/14
|
||||
export const drive = (windows ? (process.env['GITHUB_WORKSPACE'] || 'C')[0] : undefined)
|
||||
|
||||
export const inputs = {
|
||||
selfHosted: undefined
|
||||
}
|
||||
|
||||
export function partition(string, separator) {
|
||||
const i = string.indexOf(separator)
|
||||
if (i === -1) {
|
||||
@@ -166,8 +170,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
|
||||
export 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
|
||||
|
||||
Reference in New Issue
Block a user