File tree Expand file tree Collapse file tree 4 files changed +32
-4
lines changed Expand file tree Collapse file tree 4 files changed +32
-4
lines changed Original file line number Diff line number Diff line change @@ -30,6 +30,11 @@ inputs:
3030 description : |
3131 Arbitrary string that will be added to the cache key of the bundler cache. Set or change it if you need
3232 to invalidate the cache.
33+ self-hosted :
34+ description : |
35+ Consider the runner as a self-hosted runner, which means not using prebuilt Ruby binaries which only work
36+ on GitHub-hosted runners or self-hosted runners with a very similar image to the ones used by GitHub runners.
37+ The default is to detect this automatically based on the OS, OS version and $RUNNER_TOOL_CACHE.
3338outputs :
3439 ruby-prefix :
3540 description : ' The prefix of the installed ruby'
Original file line number Diff line number Diff line change @@ -13,6 +13,10 @@ export const windows = (os.platform() === 'win32')
1313// Extract to SSD on Windows, see https://github.com/ruby/setup-ruby/pull/14
1414export const drive = ( windows ? ( process . env [ 'GITHUB_WORKSPACE' ] || 'C' ) [ 0 ] : undefined )
1515
16+ export const inputs = {
17+ selfHosted : undefined
18+ }
19+
1620export function partition ( string , separator ) {
1721 const i = string . indexOf ( separator )
1822 if ( i === - 1 ) {
@@ -166,8 +170,13 @@ const GitHubHostedPlatforms = [
166170// * the OS and OS version does not correspond to a GitHub-hosted runner image,
167171// * or the hosted tool cache is different from the default tool cache path
168172export function isSelfHostedRunner ( ) {
169- return ! GitHubHostedPlatforms . includes ( getOSNameVersionArch ( ) ) ||
170- getRunnerToolCache ( ) !== getDefaultToolCachePath ( )
173+ if ( inputs . selfHosted === undefined ) {
174+ throw new Error ( 'inputs.selfHosted should have been already set' )
175+ }
176+
177+ return inputs . selfHosted === 'true' ||
178+ ! GitHubHostedPlatforms . includes ( getOSNameVersionArch ( ) ) ||
179+ getRunnerToolCache ( ) !== getDefaultToolCachePath ( )
171180}
172181
173182let virtualEnvironmentName = undefined
Original file line number Diff line number Diff line change @@ -16,6 +16,7 @@ const inputDefaults = {
1616 'bundler-cache' : 'false' ,
1717 'working-directory' : '.' ,
1818 'cache-version' : bundler . DEFAULT_CACHE_VERSION ,
19+ 'self-hosted' : 'false' ,
1920}
2021
2122// entry point when this action is run on its own
@@ -39,6 +40,7 @@ export async function setupRuby(options = {}) {
3940 inputs [ key ] = core . getInput ( key ) || inputDefaults [ key ]
4041 }
4142 }
43+ common . inputs . selfHosted = inputs [ 'self-hosted' ]
4244
4345 process . chdir ( inputs [ 'working-directory' ] )
4446
You can’t perform that action at this time.
0 commit comments