Skip to content

Commit

Permalink
Provide default getBoolInput method
Browse files Browse the repository at this point in the history
  • Loading branch information
AArnott committed Feb 3, 2020
1 parent 24a8337 commit 8ad0ea5
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 7 deletions.
5 changes: 4 additions & 1 deletion cloudbuild-task-contracts/src/Inputs.ts
Expand Up @@ -13,5 +13,8 @@ export abstract class Inputs {
* @param required A value indicating whether an explicit value for this input is required.
* @returns A boolean value.
*/
abstract getBoolInput(name: string, required?: boolean): boolean | undefined;
getBoolInput(name: string, required?: boolean): boolean | undefined {
const value = this.getInput(name, required);
return value === undefined ? undefined : value.toLowerCase() === "true";
}
}
7 changes: 1 addition & 6 deletions cloudbuild-task-github-actions/src/Inputs.ts
@@ -1,13 +1,8 @@
import * as contracts from 'cloudbuild-task-contracts';
import * as core from '@actions/core';

export class Inputs implements contracts.Inputs {
export class Inputs extends contracts.Inputs {
getInput(name: string, required?: boolean): string | undefined {
return core.getInput(name, { required: required });
}

getBoolInput(name: string, required?: boolean): boolean | undefined {
const value = this.getInput(name, required);
return value === undefined ? undefined : value.toLowerCase() === "true";
}
}

0 comments on commit 8ad0ea5

Please sign in to comment.