mirror of
https://github.com/github/codeql-action.git
synced 2026-10-30 17:39:50 +00:00
getRequiredEnvParams must be non-empty
This commit is contained in:
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user