Skip to content

Commit 1deb850

Browse files
Merge pull request #24 from sidepelican/main
2 parents 8e7c319 + 3d49ab1 commit 1deb850

File tree

6 files changed

+24
-23
lines changed

6 files changed

+24
-23
lines changed

action.yml

+1-3
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,7 @@ branding:
55
icon: download
66
inputs:
77
swift-version:
8-
description: 'Swift version to configure (default: wasm-5.7.1-RELEASE)'
9-
required: true
10-
default: 'wasm-5.7.1-RELEASE'
8+
description: 'Swift version to configure. Reads from .swift-version if unset. Use default value if both are absent.'
119
runs:
1210
using: 'node16'
1311
main: 'dist/index.js'

dist/index.js

+7-6
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/index.js.map

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/nightly/index.js

+7-6
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/nightly/index.js.map

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

index.js

+7-6
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@ const tc = require("@actions/tool-cache");
44
const os = require("os");
55
const path = require("path");
66

7+
const defaultSwiftVersion = "wasm-5.7.1-RELEASE";
8+
79
async function run(version) {
810
validateVersion(version);
911
const platform = resolveHostPlatform();
@@ -44,8 +46,8 @@ async function installToolchain(url, version, platform) {
4446
return cachedPath;
4547
}
4648

47-
function resolveVersionInput(options = {}) {
48-
const version = core.getInput('swift-version') || options.version;
49+
function resolveVersionInput() {
50+
const version = core.getInput('swift-version');
4951
if (version) {
5052
core.debug(`Using version from input: ${version}`);
5153
return version;
@@ -57,17 +59,16 @@ function resolveVersionInput(options = {}) {
5759
return versionFile;
5860
}
5961
}
60-
const message = "No Swift version specified. Please specify a version using the 'swift-version' input or a .swift-version file.";
61-
core.error(message);
62-
throw new Error(message);
62+
core.debug(`Using version from default: ${defaultSwiftVersion}`);
63+
return defaultSwiftVersion;
6364
}
6465

6566
function validateVersion(version) {
6667
if (version === "") {
6768
throw new Error("Empty version specified.");
6869
}
6970
if (!version.startsWith("wasm-")) {
70-
throw new Error(`Invalid version specified: ${version}. Version must start with 'wasm-'. For example: 'wasm-5.7.1-RELEASE'`);
71+
throw new Error(`Invalid version specified: ${version}. Version must start with 'wasm-'. For example: '${defaultSwiftVersion}'`);
7172
}
7273
}
7374

0 commit comments

Comments
 (0)