diff --git a/dist/index.js b/dist/index.js index cf4762f..54f3e15 100644 --- a/dist/index.js +++ b/dist/index.js @@ -1393,10 +1393,9 @@ async function run() { installer = __webpack_require__(442) } - const input = core.getInput('ruby-version') - const [engine, version] = parseRubyEngineAndVersion(input) + const [engine, version] = parseRubyEngineAndVersion(core.getInput('ruby-version')) const engineVersions = await installer.getAvailableVersions(engine) - const ruby = validateRubyEngineAndVersion(engineVersions, input, engine, version) + const ruby = validateRubyEngineAndVersion(platform, engineVersions, engine, version) const rubyPrefix = await installer.install(platform, ruby) core.setOutput('ruby-prefix', rubyPrefix) @@ -1425,9 +1424,9 @@ function parseRubyEngineAndVersion(rubyVersion) { return [engine, version] } -function validateRubyEngineAndVersion(engineVersions, input, engine, version) { +function validateRubyEngineAndVersion(platform, engineVersions, engine, version) { if (!engineVersions) { - throw new Error(`Unknown engine ${engine} (input: ${input})`) + throw new Error(`Unknown engine ${engine} on ${platform}`) } if (!engineVersions.includes(version)) { @@ -1436,9 +1435,8 @@ function validateRubyEngineAndVersion(engineVersions, input, engine, version) { if (found) { version = found } else { - throw new Error(`Unknown version ${version} for ${engine} - input: ${input} - available versions for ${engine}: ${engineVersions.join(', ')} + throw new Error(`Unknown version ${version} for ${engine} on ${platform} + available versions for ${engine} on ${platform}: ${engineVersions.join(', ')} File an issue at https://github.com/eregon/use-ruby-action/issues if would like support for a new version`) } } diff --git a/index.js b/index.js index c9fbc29..9e12fa2 100644 --- a/index.js +++ b/index.js @@ -12,10 +12,9 @@ async function run() { installer = require('./ruby-install-builder') } - const input = core.getInput('ruby-version') - const [engine, version] = parseRubyEngineAndVersion(input) + const [engine, version] = parseRubyEngineAndVersion(core.getInput('ruby-version')) const engineVersions = await installer.getAvailableVersions(engine) - const ruby = validateRubyEngineAndVersion(engineVersions, input, engine, version) + const ruby = validateRubyEngineAndVersion(platform, engineVersions, engine, version) const rubyPrefix = await installer.install(platform, ruby) core.setOutput('ruby-prefix', rubyPrefix) @@ -44,9 +43,9 @@ function parseRubyEngineAndVersion(rubyVersion) { return [engine, version] } -function validateRubyEngineAndVersion(engineVersions, input, engine, version) { +function validateRubyEngineAndVersion(platform, engineVersions, engine, version) { if (!engineVersions) { - throw new Error(`Unknown engine ${engine} (input: ${input})`) + throw new Error(`Unknown engine ${engine} on ${platform}`) } if (!engineVersions.includes(version)) { @@ -55,9 +54,8 @@ function validateRubyEngineAndVersion(engineVersions, input, engine, version) { if (found) { version = found } else { - throw new Error(`Unknown version ${version} for ${engine} - input: ${input} - available versions for ${engine}: ${engineVersions.join(', ')} + throw new Error(`Unknown version ${version} for ${engine} on ${platform} + available versions for ${engine} on ${platform}: ${engineVersions.join(', ')} File an issue at https://github.com/eregon/use-ruby-action/issues if would like support for a new version`) } }