Skip to content

Commit

Permalink
Allow absolute version file paths (#258)
Browse files Browse the repository at this point in the history
  • Loading branch information
maennchen authored Feb 29, 2024
1 parent 0430fb6 commit 4f55815
Show file tree
Hide file tree
Showing 3 changed files with 12 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
10 changes: 10 additions & 0 deletions test/setup-beam.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ simulateInput('hexpm-mirrors', 'https://builds.hex.pm', { multiline: true })

const assert = require('assert')
const fs = require('fs')
const os = require('os')
const path = require('path')
const core = require('@actions/core')
const setupBeam = require('../src/setup-beam')
const { problemMatcher } = require('../matchers/elixir-matchers.json')
Expand Down Expand Up @@ -535,6 +537,14 @@ rebar ${rebar3}`
assert.strictEqual(appVersions.get('erlang'), erlang)
assert.strictEqual(appVersions.get('elixir'), elixir)

const absoluteFilename = path.join(os.tmpdir(), '.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 4f55815

Please sign in to comment.