Skip to content

Commit 9219e83

Browse files
committed
Throw error if OS platform is unsupported
1 parent befa8b3 commit 9219e83

File tree

2 files changed

+12
-4
lines changed

2 files changed

+12
-4
lines changed

dist/index.js

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -479,9 +479,10 @@ function exec(cmd) {
479479

480480
try {
481481
const version = core.getInput('version');
482-
console.log(`Installing foundationdb ${version} (${os.platform()})!`);
482+
let platform = os.platform();
483+
console.log(`Installing foundationdb ${version} (${platform})!`);
483484
let base_url = `https://github.com/apple/foundationdb/releases/download/${version}`;
484-
switch (os.platform()) {
485+
switch (platform) {
485486
case 'linux': {
486487
let client_url = `${base_url}/foundationdb-clients_${version}-1_amd64.deb`;
487488
exec(`curl -L -O ${client_url}`);
@@ -498,6 +499,9 @@ try {
498499
exec(`sudo installer -pkg FoundationDB-${version}.pkg -target /`);
499500
break;
500501
}
502+
default:
503+
throw Error(`Unsupported OS platform: ${platform}. Supported options are linux and darwin.`
504+
+ ` Check that this action is being used with either ubuntu-latest or macos-latest.`);
501505
}
502506

503507
} catch (error) {

index.js

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,10 @@ function exec(cmd) {
1010

1111
try {
1212
const version = core.getInput('version');
13-
console.log(`Installing foundationdb ${version} (${os.platform()})!`);
13+
let platform = os.platform();
14+
console.log(`Installing foundationdb ${version} (${platform})!`);
1415
let base_url = `https://github.com/apple/foundationdb/releases/download/${version}`;
15-
switch (os.platform()) {
16+
switch (platform) {
1617
case 'linux': {
1718
let client_url = `${base_url}/foundationdb-clients_${version}-1_amd64.deb`;
1819
exec(`curl -L -O ${client_url}`);
@@ -29,6 +30,9 @@ try {
2930
exec(`sudo installer -pkg FoundationDB-${version}.pkg -target /`);
3031
break;
3132
}
33+
default:
34+
throw Error(`Unsupported OS platform: ${platform}. Supported options are linux and darwin.`
35+
+ ` Check that this action is being used with either ubuntu-latest or macos-latest.`);
3236
}
3337

3438
} catch (error) {

0 commit comments

Comments
 (0)