Skip to content

Commit

Permalink
Fail on invalid boolean for Develocity inputs
Browse files Browse the repository at this point in the history
  • Loading branch information
bigdaz committed Jun 13, 2024
1 parent e3bc05f commit 30c82f0
Showing 1 changed file with 8 additions and 12 deletions.
20 changes: 8 additions & 12 deletions sources/src/configuration.ts
Original file line number Diff line number Diff line change
Expand Up @@ -217,23 +217,23 @@ export class BuildScanConfig {
}

getDevelocityInjectionEnabled(): boolean | undefined {
return getMaybeBooleanInput('develocity-injection-enabled')
return getOptionalBooleanInput('develocity-injection-enabled')
}

getDevelocityUrl(): string {
return core.getInput('develocity-url')
}

getDevelocityAllowUntrustedServer(): boolean | undefined {
return getMaybeBooleanInput('develocity-allow-untrusted-server')
return getOptionalBooleanInput('develocity-allow-untrusted-server')
}

getDevelocityCaptureFileFingerprints(): boolean | undefined {
return getMaybeBooleanInput('develocity-capture-file-fingerprints')
return getOptionalBooleanInput('develocity-capture-file-fingerprints')
}

getDevelocityEnforceUrl(): boolean | undefined {
return getMaybeBooleanInput('develocity-enforce-url')
return getOptionalBooleanInput('develocity-enforce-url')
}

getDevelocityPluginVersion(): string {
Expand Down Expand Up @@ -370,14 +370,10 @@ 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 {
function getOptionalBooleanInput(paramName: string): boolean | undefined {
const paramValue = core.getInput(paramName)
switch (paramValue?.toLowerCase().trim()) {
case 'false':
return false
case 'true':
return true
default:
return undefined
if (paramValue === '') {
return undefined
}
return getBooleanInput(paramName)
}

0 comments on commit 30c82f0

Please sign in to comment.