Refactor input parameters

Moved reading of all input parameters into a common source: `input-params.ts`.
This centralized all input parameter reads, and allowed an improved implementation
of reading boolean parameters. In particular, the implementation now provides a default
value for a boolean input parameter that isn't declared for an action.
This commit is contained in:
daz 2023-06-03 15:58:54 -06:00
parent c94d573317
commit 07023d3e3e
No known key found for this signature in database
8 changed files with 102 additions and 42 deletions

View file

@ -5,6 +5,7 @@ import * as path from 'path'
import * as os from 'os'
import * as caches from './caches'
import * as layout from './repository-layout'
import * as params from './input-params'
import {logJobSummary, writeJobSummary} from './job-summary'
import {loadBuildResults} from './build-results'
@ -14,7 +15,6 @@ import {DaemonController} from './daemon-controller'
const GRADLE_SETUP_VAR = 'GRADLE_BUILD_ACTION_SETUP_COMPLETED'
const GRADLE_USER_HOME = 'GRADLE_USER_HOME'
const CACHE_LISTENER = 'CACHE_LISTENER'
const JOB_SUMMARY_ENABLED_PARAMETER = 'generate-job-summary'
export async function setup(): Promise<void> {
const gradleUserHome = await determineGradleUserHome()
@ -93,5 +93,5 @@ function shouldGenerateJobSummary(): boolean {
return false
}
return core.getBooleanInput(JOB_SUMMARY_ENABLED_PARAMETER)
return params.isJobSummaryEnabled()
}