Make not specifying a required input a user error
This commit is contained in:
parent
81ae676e79
commit
5691205077
3 changed files with 11 additions and 3 deletions
6
lib/actions-util.js
generated
6
lib/actions-util.js
generated
|
|
@ -39,7 +39,11 @@ const pkg = require("../package.json");
|
||||||
* This allows us to get stronger type checking of required/optional inputs.
|
* This allows us to get stronger type checking of required/optional inputs.
|
||||||
*/
|
*/
|
||||||
const getRequiredInput = function (name) {
|
const getRequiredInput = function (name) {
|
||||||
return core.getInput(name, { required: true });
|
const value = core.getInput(name);
|
||||||
|
if (!value) {
|
||||||
|
throw new util_1.UserError(`Input required and not supplied: ${name}`);
|
||||||
|
}
|
||||||
|
return value;
|
||||||
};
|
};
|
||||||
exports.getRequiredInput = getRequiredInput;
|
exports.getRequiredInput = getRequiredInput;
|
||||||
/**
|
/**
|
||||||
|
|
|
||||||
File diff suppressed because one or more lines are too long
|
|
@ -24,7 +24,11 @@ const pkg = require("../package.json") as JSONSchemaForNPMPackageJsonFiles;
|
||||||
* This allows us to get stronger type checking of required/optional inputs.
|
* This allows us to get stronger type checking of required/optional inputs.
|
||||||
*/
|
*/
|
||||||
export const getRequiredInput = function (name: string): string {
|
export const getRequiredInput = function (name: string): string {
|
||||||
return core.getInput(name, { required: true });
|
const value = core.getInput(name);
|
||||||
|
if (!value) {
|
||||||
|
throw new UserError(`Input required and not supplied: ${name}`);
|
||||||
|
}
|
||||||
|
return value;
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue