mirror of
https://github.com/nick-fields/retry.git
synced 2026-02-10 07:05:29 +00:00
feat(shell): checks only the shell name and allows any argument (#118)
Co-authored-by: ureciocais <urecio@caisgroup.com> Co-authored-by: Nick Fields <46869826+nick-fields@users.noreply.github.com>
This commit is contained in:
11
dist/index.js
vendored
11
dist/index.js
vendored
@@ -948,7 +948,8 @@ function getExecutable(inputs) {
|
||||
return OS === 'win32' ? 'powershell' : 'bash';
|
||||
}
|
||||
var executable;
|
||||
switch (inputs.shell) {
|
||||
var shellName = inputs.shell.split(' ')[0];
|
||||
switch (shellName) {
|
||||
case 'bash':
|
||||
case 'python':
|
||||
case 'pwsh': {
|
||||
@@ -957,7 +958,7 @@ function getExecutable(inputs) {
|
||||
}
|
||||
case 'sh': {
|
||||
if (OS === 'win32') {
|
||||
throw new Error("Shell ".concat(inputs.shell, " not allowed on OS ").concat(OS));
|
||||
throw new Error("Shell ".concat(shellName, " not allowed on OS ").concat(OS));
|
||||
}
|
||||
executable = inputs.shell;
|
||||
break;
|
||||
@@ -965,13 +966,13 @@ function getExecutable(inputs) {
|
||||
case 'cmd':
|
||||
case 'powershell': {
|
||||
if (OS !== 'win32') {
|
||||
throw new Error("Shell ".concat(inputs.shell, " not allowed on OS ").concat(OS));
|
||||
throw new Error("Shell ".concat(shellName, " not allowed on OS ").concat(OS));
|
||||
}
|
||||
executable = inputs.shell + '.exe';
|
||||
executable = shellName + '.exe' + inputs.shell.replace(shellName, '');
|
||||
break;
|
||||
}
|
||||
default: {
|
||||
throw new Error("Shell ".concat(inputs.shell, " not supported. See https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idstepsshell for supported shells"));
|
||||
throw new Error("Shell ".concat(shellName, " not supported. See https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idstepsshell for supported shells"));
|
||||
}
|
||||
}
|
||||
return executable;
|
||||
|
||||
12
src/index.ts
12
src/index.ts
@@ -20,7 +20,9 @@ function getExecutable(inputs: Inputs): string {
|
||||
}
|
||||
|
||||
let executable: string;
|
||||
switch (inputs.shell) {
|
||||
const shellName = inputs.shell.split(' ')[0];
|
||||
|
||||
switch (shellName) {
|
||||
case 'bash':
|
||||
case 'python':
|
||||
case 'pwsh': {
|
||||
@@ -29,7 +31,7 @@ function getExecutable(inputs: Inputs): string {
|
||||
}
|
||||
case 'sh': {
|
||||
if (OS === 'win32') {
|
||||
throw new Error(`Shell ${inputs.shell} not allowed on OS ${OS}`);
|
||||
throw new Error(`Shell ${shellName} not allowed on OS ${OS}`);
|
||||
}
|
||||
executable = inputs.shell;
|
||||
break;
|
||||
@@ -37,14 +39,14 @@ function getExecutable(inputs: Inputs): string {
|
||||
case 'cmd':
|
||||
case 'powershell': {
|
||||
if (OS !== 'win32') {
|
||||
throw new Error(`Shell ${inputs.shell} not allowed on OS ${OS}`);
|
||||
throw new Error(`Shell ${shellName} not allowed on OS ${OS}`);
|
||||
}
|
||||
executable = inputs.shell + '.exe';
|
||||
executable = shellName + '.exe' + inputs.shell.replace(shellName, '');
|
||||
break;
|
||||
}
|
||||
default: {
|
||||
throw new Error(
|
||||
`Shell ${inputs.shell} not supported. See https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idstepsshell for supported shells`
|
||||
`Shell ${shellName} not supported. See https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idstepsshell for supported shells`
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user