mirror of
https://github.com/ruby/setup-ruby.git
synced 2026-09-13 14:34:21 +02:00
Define a helper to download to avoid duplication
This commit is contained in:
+1
-3
@@ -4,7 +4,6 @@ const path = require('path')
|
||||
const core = require('@actions/core')
|
||||
const exec = require('@actions/exec')
|
||||
const io = require('@actions/io')
|
||||
const tc = require('@actions/tool-cache')
|
||||
const common = require('./common')
|
||||
const rubyBuilderVersions = require('./ruby-builder-versions')
|
||||
|
||||
@@ -74,9 +73,8 @@ async function downloadAndExtract(platform, engine, version, rubyPrefix) {
|
||||
const downloadPath = await common.measure('Downloading Ruby', async () => {
|
||||
const url = getDownloadURL(platform, engine, version)
|
||||
console.log(url)
|
||||
const auth = common.inputs.token ? `token ${common.inputs.token}` : undefined
|
||||
try {
|
||||
return await tc.downloadTool(url, undefined, auth)
|
||||
return await common.download(url)
|
||||
} catch (error) {
|
||||
if (error.message.includes('404')) {
|
||||
throw new Error(`Unavailable version ${version} for ${engine} on ${platform}
|
||||
|
||||
Reference in New Issue
Block a user