getRequiredEnvParams must be non-empty
This commit is contained in:
parent
17548064f9
commit
bb9ed79f3d
6 changed files with 17 additions and 4 deletions
|
|
@ -64,3 +64,10 @@ test('getThreadsFlag() throws if the ram input is < 0 or NaN', t => {
|
|||
t.throws(util.getThreadsFlag);
|
||||
}
|
||||
});
|
||||
|
||||
test('getRef() throws on the empty string', t => {
|
||||
for (const input of [""]) {
|
||||
process.env["GITHUB_REF"] = input;
|
||||
t.throws(util.getRef);
|
||||
}
|
||||
});
|
||||
|
|
|
|||
|
|
@ -37,7 +37,7 @@ export function should_abort(actionName: string, requireInitActionHasRun: boolea
|
|||
*/
|
||||
export function getRequiredEnvParam(paramName: string): string {
|
||||
const value = process.env[paramName];
|
||||
if (value === undefined) {
|
||||
if (value === undefined || value.length === 0) {
|
||||
throw new Error(paramName + ' environment variable must be set');
|
||||
}
|
||||
core.debug(paramName + '=' + value);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue