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 48f1d0c commit fc2e991
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 4 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
5 changes: 3 additions & 2 deletions test/setup-beam.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ simulateInput('hexpm-mirrors', 'https://builds.hex.pm', { multiline: true })

const assert = require('assert')
const fs = require('fs')
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 @@ -528,9 +529,9 @@ elixir ref:${elixir} # comment, with space and ref:
not-gleam 0.23 # not picked up
gleam ${gleam}
rebar ${rebar3}`
const filename = 'test/.tool-versions'
const filename = path.resolve(__dirname, '.tool-versions')
fs.writeFileSync(filename, toolVersions)
process.env.GITHUB_WORKSPACE = ''
process.env.GITHUB_WORKSPACE = '/tmp'
const appVersions = setupBeam.parseVersionFile(filename)
assert.strictEqual(appVersions.get('erlang'), erlang)
assert.strictEqual(appVersions.get('elixir'), elixir)
Expand Down

0 comments on commit fc2e991

Please sign in to comment.