mirror of
https://github.com/gradle/gradle-build-action.git
synced 2025-07-03 05:45:59 +02:00
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:
parent
c94d573317
commit
07023d3e3e
8 changed files with 102 additions and 42 deletions
|
@ -7,6 +7,7 @@ import * as cache from '@actions/cache'
|
|||
import * as toolCache from '@actions/tool-cache'
|
||||
|
||||
import * as gradlew from './gradlew'
|
||||
import * as params from './input-params'
|
||||
import * as layout from './repository-layout'
|
||||
import {handleCacheFailure, isCacheDisabled, isCacheReadOnly} from './cache-utils'
|
||||
|
||||
|
@ -17,12 +18,12 @@ const gradleVersionsBaseUrl = 'https://services.gradle.org/versions'
|
|||
* @return Installed Gradle executable or undefined if no version configured.
|
||||
*/
|
||||
export async function provisionGradle(): Promise<string | undefined> {
|
||||
const gradleVersion = core.getInput('gradle-version')
|
||||
const gradleVersion = params.getGradleVersion()
|
||||
if (gradleVersion !== '' && gradleVersion !== 'wrapper') {
|
||||
return addToPath(path.resolve(await installGradle(gradleVersion)))
|
||||
}
|
||||
|
||||
const gradleExecutable = core.getInput('gradle-executable')
|
||||
const gradleExecutable = params.getGradleExecutable()
|
||||
if (gradleExecutable !== '') {
|
||||
const workspaceDirectory = layout.workspaceDirectory()
|
||||
return addToPath(path.resolve(workspaceDirectory, gradleExecutable))
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue