mirror of
https://github.com/gradle/gradle-build-action.git
synced 2024-11-22 17:12:51 +00:00
24 lines
663 B
TypeScript
24 lines
663 B
TypeScript
import * as core from '@actions/core'
|
|
|
|
export function inputOrNull(name: string): string | null {
|
|
const inputString = core.getInput(name, {required: false})
|
|
if (inputString.length === 0) {
|
|
return null
|
|
}
|
|
return inputString
|
|
}
|
|
|
|
export function inputArrayOrNull(name: string): string[] | null {
|
|
const string = inputOrNull(name)
|
|
if (!string) return null
|
|
return string
|
|
.split('\n')
|
|
.map(s => s.trim())
|
|
.filter(s => s !== '')
|
|
}
|
|
|
|
export function inputBoolean(name: string, defaultValue = false): boolean {
|
|
const string = inputOrNull(name)
|
|
if (!string) return defaultValue
|
|
return string === 'true'
|
|
}
|