mirror of
https://git.mirrors.martin98.com/https://github.com/actions/toolkit
synced 2026-03-20 03:32:40 +08:00
Add tests, getInput should be case-insensitive and trim output
This commit is contained in:
@@ -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();
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------
|
||||
|
||||
Reference in New Issue
Block a user