2020-01-31 13:57:22 -05:00
import * as core from '@actions/core' ;
import * as cache from './cache' ;
export async function run() {
try {
2021-01-29 16:44:28 +03:00
core . info ( 'Please note: this action is deprecated and will not be maintained in future by GitHub engineers. Please, migrate to https://github.com/ruby/setup-ruby from official Ruby community.' ) ;
2020-01-31 13:57:22 -05:00
let versionSpec = core . getInput ( 'ruby-version' , { required : true } ) ;
if ( ! versionSpec ) {
// deprecated
versionSpec = core . getInput ( 'version' ) ;
}
// check in the VMs cache first
let toolPath : string = await cache . find ( versionSpec ) ;
// TODO: download JIT and/or ruby-build
if ( ! toolPath ) {
core . setFailed ( ` Version ${ versionSpec } not found ` ) ;
return ;
}
core . addPath ( toolPath ) ;
} catch ( error ) {
// unhandled
core . setFailed ( error . message ) ;
}
}