neiam /action-setup-beam
action-setup-beam
public · Issues · Pulls · Labels · Forks · Compare · Actions queued
⭐
Log in to mark this repository.
🐛 Fix OTP version null check (#211)
df9a609 · Christoph Grothaus · 2023-06-15 13:45
Message
{commit_body(@commit)}
Files changed
modified
dist/index.js
+5
−0
@@ -10247,6 +10247,11 @@ function getVersionFromSpec(spec, versions, maybePrependWithV0) {
| 10247 | 10247 | if (maybePrependWithV0 && v != null) { |
| 10248 | 10248 | v = maybePrependWithV(v) |
| 10249 | 10249 | } |
| 10250 | + | |
| 10251 | + if (!versions.includes(v)) { | |
| 10252 | + v = null | |
| 10253 | + } | |
| 10254 | + | |
| 10250 | 10255 | return v |
| 10251 | 10256 | } |
| 10252 | 10257 |
modified
src/setup-beam.js
+5
−0
@@ -375,6 +375,11 @@ function getVersionFromSpec(spec, versions, maybePrependWithV0) {
| 375 | 375 | if (maybePrependWithV0 && v != null) { |
| 376 | 376 | v = maybePrependWithV(v) |
| 377 | 377 | } |
| 378 | + | |
| 379 | + if (!versions.includes(v)) { | |
| 380 | + v = null | |
| 381 | + } | |
| 382 | + | |
| 378 | 383 | return v |
| 379 | 384 | } |
| 380 | 385 |
modified
test/setup-beam.test.js
+7
−0
@@ -413,6 +413,13 @@ async function testGetVersionFromSpec() {
| 413 | 413 | got = setupBeam.getVersionFromSpec(spec, versions) |
| 414 | 414 | assert.deepStrictEqual(got, expected) |
| 415 | 415 | simulateInput('version-type', before) |
| 416 | + | |
| 417 | + before = simulateInput('version-type', 'strict') | |
| 418 | + spec = '22.3.4.3' | |
| 419 | + expected = null | |
| 420 | + got = setupBeam.getVersionFromSpec(spec, versions) | |
| 421 | + assert.deepStrictEqual(got, expected) | |
| 422 | + simulateInput('version-type', before) | |
| 416 | 423 | } |
| 417 | 424 | |
| 418 | 425 | async function testParseVersionFile() { |
Parents: 54d4f15