Skip to content

Commit

Permalink
Allow absolute version file paths
Browse files Browse the repository at this point in the history
  • Loading branch information
maennchen committed Feb 29, 2024
1 parent 0430fb6 commit 8bc9b33
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 2 deletions.
2 changes: 1 addition & 1 deletion dist/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -10422,7 +10422,7 @@ alongside ${alternativeName}=${alternativeValue} \
}

function parseVersionFile(versionFilePath0) {
const versionFilePath = path.join(
const versionFilePath = path.resolve(
process.env.GITHUB_WORKSPACE,
versionFilePath0,
)
Expand Down
2 changes: 1 addition & 1 deletion src/setup-beam.js
Original file line number Diff line number Diff line change
Expand Up @@ -591,7 +591,7 @@ alongside ${alternativeName}=${alternativeValue} \
}

function parseVersionFile(versionFilePath0) {
const versionFilePath = path.join(
const versionFilePath = path.resolve(
process.env.GITHUB_WORKSPACE,
versionFilePath0,
)
Expand Down
8 changes: 8 additions & 0 deletions test/setup-beam.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -535,6 +535,14 @@ rebar ${rebar3}`
assert.strictEqual(appVersions.get('erlang'), erlang)
assert.strictEqual(appVersions.get('elixir'), elixir)

const absoluteFilename = '/tmp/.tool-versions'
fs.writeFileSync(absoluteFilename, toolVersions)

process.env.GITHUB_WORKSPACE = process.cwd()
const absoluteAppVersions = setupBeam.parseVersionFile(absoluteFilename)
assert.strictEqual(absoluteAppVersions.get('erlang'), erlang)
assert.strictEqual(absoluteAppVersions.get('elixir'), elixir)

assert.ok(async () => {
await setupBeam.install('otp', { toolVersion: erlang })
})
Expand Down

0 comments on commit 8bc9b33

Please sign in to comment.