neiam /action-setup-beam
action-setup-beam
public · Issues · Pulls · Labels · Forks · Compare · Actions queued
⭐
Log in to mark this repository.
Allow absolute version file paths (#258)
4f55815 · Jonatan Männchen · 2024-02-29 22:37
Files changed
modified
dist/index.js
+1
−1
@@ -10422,7 +10422,7 @@ alongside ${alternativeName}=${alternativeValue} \
| 10422 | 10422 | } |
| 10423 | 10423 | |
| 10424 | 10424 | function parseVersionFile(versionFilePath0) { |
| 10425 | − const versionFilePath = path.join( | |
| 10425 | + const versionFilePath = path.resolve( | |
| 10426 | 10426 | process.env.GITHUB_WORKSPACE, |
| 10427 | 10427 | versionFilePath0, |
| 10428 | 10428 | ) |
modified
src/setup-beam.js
+1
−1
@@ -591,7 +591,7 @@ alongside ${alternativeName}=${alternativeValue} \
| 591 | 591 | } |
| 592 | 592 | |
| 593 | 593 | function parseVersionFile(versionFilePath0) { |
| 594 | − const versionFilePath = path.join( | |
| 594 | + const versionFilePath = path.resolve( | |
| 595 | 595 | process.env.GITHUB_WORKSPACE, |
| 596 | 596 | versionFilePath0, |
| 597 | 597 | ) |
modified
test/setup-beam.test.js
+10
−0
@@ -8,6 +8,8 @@ simulateInput('hexpm-mirrors', 'https://builds.hex.pm', { multiline: true })
| 8 | 8 | |
| 9 | 9 | const assert = require('assert') |
| 10 | 10 | const fs = require('fs') |
| 11 | +const os = require('os') | |
| 12 | +const path = require('path') | |
| 11 | 13 | const core = require('@actions/core') |
| 12 | 14 | const setupBeam = require('../src/setup-beam') |
| 13 | 15 | const { problemMatcher } = require('../matchers/elixir-matchers.json') |
@@ -535,6 +537,14 @@ rebar ${rebar3}`
| 535 | 537 | assert.strictEqual(appVersions.get('erlang'), erlang) |
| 536 | 538 | assert.strictEqual(appVersions.get('elixir'), elixir) |
| 537 | 539 | |
| 540 | + const absoluteFilename = path.join(os.tmpdir(), '.tool-versions') | |
| 541 | + fs.writeFileSync(absoluteFilename, toolVersions) | |
| 542 | + | |
| 543 | + process.env.GITHUB_WORKSPACE = process.cwd() | |
| 544 | + const absoluteAppVersions = setupBeam.parseVersionFile(absoluteFilename) | |
| 545 | + assert.strictEqual(absoluteAppVersions.get('erlang'), erlang) | |
| 546 | + assert.strictEqual(absoluteAppVersions.get('elixir'), elixir) | |
| 547 | + | |
| 538 | 548 | assert.ok(async () => { |
| 539 | 549 | await setupBeam.install('otp', { toolVersion: erlang }) |
| 540 | 550 | }) |
Parents: 0430fb6