mirror of
https://github.com/gradle/actions.git
synced 2025-04-22 02:39:19 +08:00
Added getMaybeBooleanInput to parse boolean inputs
This commit is contained in:
parent
16af475857
commit
f616d16c33
@ -216,24 +216,24 @@ export class BuildScanConfig {
|
||||
return core.getInput('develocity-token-expiry')
|
||||
}
|
||||
|
||||
getDevelocityInjectionEnabled(): string {
|
||||
return core.getInput('develocity-injection-enabled')
|
||||
getDevelocityInjectionEnabled(): boolean | undefined {
|
||||
return getMaybeBooleanInput('develocity-injection-enabled')
|
||||
}
|
||||
|
||||
getDevelocityUrl(): string {
|
||||
return core.getInput('develocity-url')
|
||||
}
|
||||
|
||||
getDevelocityAllowUntrustedServer(): string {
|
||||
return core.getInput('develocity-allow-untrusted-server')
|
||||
getDevelocityAllowUntrustedServer(): boolean | undefined {
|
||||
return getMaybeBooleanInput('develocity-allow-untrusted-server')
|
||||
}
|
||||
|
||||
getDevelocityCaptureFileFingerprints(): string {
|
||||
return core.getInput('develocity-capture-file-fingerprints')
|
||||
getDevelocityCaptureFileFingerprints(): boolean | undefined {
|
||||
return getMaybeBooleanInput('develocity-capture-file-fingerprints')
|
||||
}
|
||||
|
||||
getDevelocityEnforceUrl(): string {
|
||||
return core.getInput('develocity-enforce-url')
|
||||
getDevelocityEnforceUrl(): boolean | undefined {
|
||||
return getMaybeBooleanInput('develocity-enforce-url')
|
||||
}
|
||||
|
||||
getDevelocityPluginVersion(): string {
|
||||
@ -369,3 +369,15 @@ function getBooleanInput(paramName: string, paramDefault = false): boolean {
|
||||
}
|
||||
throw TypeError(`The value '${paramValue} is not valid for '${paramName}. Valid values are: [true, false]`)
|
||||
}
|
||||
|
||||
function getMaybeBooleanInput(paramName: string): boolean | undefined {
|
||||
const paramValue = core.getInput(paramName)
|
||||
switch (paramValue?.toLowerCase().trim()) {
|
||||
case 'false':
|
||||
return false
|
||||
case 'true':
|
||||
return true
|
||||
default:
|
||||
return undefined
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user