Skip to content

Commit

Permalink
Rename getVirtualEnvironmentName() to getOSNameVersion() for clarity
Browse files Browse the repository at this point in the history
  • Loading branch information
eregon committed Oct 11, 2023
1 parent d37167a commit b1c3bf6
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 19 deletions.
16 changes: 8 additions & 8 deletions common.js
Original file line number Diff line number Diff line change
Expand Up @@ -192,11 +192,11 @@ export function selfHostedRunnerReason() {
}
}

let virtualEnvironmentName = undefined
let osNameVersion = undefined

export function getVirtualEnvironmentName() {
if (virtualEnvironmentName !== undefined) {
return virtualEnvironmentName
export function getOSNameVersion() {
if (osNameVersion !== undefined) {
return osNameVersion
}

const platform = os.platform()
Expand All @@ -216,12 +216,12 @@ export function getVirtualEnvironmentName() {
throw new Error(`Unknown platform ${platform}`)
}

virtualEnvironmentName = `${osName}-${osVersion}`
return virtualEnvironmentName
osNameVersion = `${osName}-${osVersion}`
return osNameVersion
}

export function getOSNameVersionArch() {
return `${getVirtualEnvironmentName()}-${os.arch()}`
return `${getOSNameVersion()}-${os.arch()}`
}

function findWindowsVersion() {
Expand Down Expand Up @@ -258,7 +258,7 @@ export function getRunnerToolCache() {

// Rubies prebuilt by this action embed this path rather than using $RUNNER_TOOL_CACHE
function getDefaultToolCachePath() {
const platform = getVirtualEnvironmentName()
const platform = getOSNameVersion()
if (platform.startsWith('ubuntu-')) {
return '/opt/hostedtoolcache'
} else if (platform.startsWith('macos-')) {
Expand Down
23 changes: 13 additions & 10 deletions dist/index.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 3 additions & 1 deletion index.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import {getOSNameVersion} from "./common";

const os = require('os')
const fs = require('fs')
const path = require('path')
Expand Down Expand Up @@ -44,7 +46,7 @@ export async function setupRuby(options = {}) {

process.chdir(inputs['working-directory'])

const platform = common.getVirtualEnvironmentName()
const platform = common.getOSNameVersion()
const [engine, parsedVersion] = parseRubyEngineAndVersion(inputs['ruby-version'])

let installer
Expand Down

0 comments on commit b1c3bf6

Please sign in to comment.