Skip to content

Commit

Permalink
Make not specifying a required input a user error
Browse files Browse the repository at this point in the history
  • Loading branch information
Henry Mercer committed Jul 28, 2023
1 parent 81ae676 commit 5691205
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 3 deletions.
6 changes: 5 additions & 1 deletion lib/actions-util.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion lib/actions-util.js.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 5 additions & 1 deletion src/actions-util.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,11 @@ const pkg = require("../package.json") as JSONSchemaForNPMPackageJsonFiles;
* This allows us to get stronger type checking of required/optional inputs.
*/
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;
};

/**
Expand Down

0 comments on commit 5691205

Please sign in to comment.