Add tests, getInput should be case-insensitive and trim output

This commit is contained in:
Danny McCormick
2019-05-17 10:31:07 -04:00
parent 7c079ef90d
commit 5f31b6acfc
3 changed files with 4 additions and 4 deletions

View File

@@ -34,12 +34,12 @@ export function setSecret(name: string, val: string) {
* @returns string
*/
export function getInput(name: string, options?: im.InputOptions): string {
let val:string = process.env['INPUT_' + name];
let val: string = process.env['INPUT_' + name.replace(' ', '_').toUpperCase()] || '';
if (options && options.required && !val) {
throw new Error(`Input required and not supplied: ${name}`);
}
return val;
return val.trim();
}
//-----------------------------------------------------------------------