mirror of
https://github.com/gradle/actions.git
synced 2025-04-22 18:59: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')
|
return core.getInput('develocity-token-expiry')
|
||||||
}
|
}
|
||||||
|
|
||||||
getDevelocityInjectionEnabled(): string {
|
getDevelocityInjectionEnabled(): boolean | undefined {
|
||||||
return core.getInput('develocity-injection-enabled')
|
return getMaybeBooleanInput('develocity-injection-enabled')
|
||||||
}
|
}
|
||||||
|
|
||||||
getDevelocityUrl(): string {
|
getDevelocityUrl(): string {
|
||||||
return core.getInput('develocity-url')
|
return core.getInput('develocity-url')
|
||||||
}
|
}
|
||||||
|
|
||||||
getDevelocityAllowUntrustedServer(): string {
|
getDevelocityAllowUntrustedServer(): boolean | undefined {
|
||||||
return core.getInput('develocity-allow-untrusted-server')
|
return getMaybeBooleanInput('develocity-allow-untrusted-server')
|
||||||
}
|
}
|
||||||
|
|
||||||
getDevelocityCaptureFileFingerprints(): string {
|
getDevelocityCaptureFileFingerprints(): boolean | undefined {
|
||||||
return core.getInput('develocity-capture-file-fingerprints')
|
return getMaybeBooleanInput('develocity-capture-file-fingerprints')
|
||||||
}
|
}
|
||||||
|
|
||||||
getDevelocityEnforceUrl(): string {
|
getDevelocityEnforceUrl(): boolean | undefined {
|
||||||
return core.getInput('develocity-enforce-url')
|
return getMaybeBooleanInput('develocity-enforce-url')
|
||||||
}
|
}
|
||||||
|
|
||||||
getDevelocityPluginVersion(): string {
|
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]`)
|
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