mirror of
https://github.com/gradle/gradle-build-action.git
synced 2024-11-26 02:52:09 +00:00
Use current matrix values for workflow job context
This commit is contained in:
parent
d20d631365
commit
9b3abaad52
3 changed files with 8 additions and 10 deletions
|
@ -24,6 +24,10 @@ inputs:
|
||||||
description: Whether caching of Gradle User Home and project .gradle directory is enabled. Valid values are 'true' (default), 'false', and 'read-only'.
|
description: Whether caching of Gradle User Home and project .gradle directory is enabled. Valid values are 'true' (default), 'false', and 'read-only'.
|
||||||
required: false
|
required: false
|
||||||
default: true
|
default: true
|
||||||
|
workflow-job-context:
|
||||||
|
description: Used to uniquely identify the current job invocation. Defaults to the matrix values for this job; this should not be overridden by users.
|
||||||
|
required: false
|
||||||
|
default: ${{ toJSON(matrix) }}
|
||||||
|
|
||||||
outputs:
|
outputs:
|
||||||
build-scan-url:
|
build-scan-url:
|
||||||
|
|
|
@ -51,16 +51,9 @@ function generateCacheKey(cacheName: string): CacheKey {
|
||||||
}
|
}
|
||||||
|
|
||||||
function determineJobContext(): string {
|
function determineJobContext(): string {
|
||||||
// Ideally we'd serialize the entire matrix values here, but matrix is not available within the action invocation.
|
// By default, we hash the full `matrix` data for the run, to uniquely identify this job invocation
|
||||||
// Use the JAVA_HOME value as a proxy for the java version
|
const workflowJobContext = core.getInput('workflow-job-context')
|
||||||
const javaHome = process.env['JAVA_HOME'] || ''
|
return hashStrings([workflowJobContext])
|
||||||
|
|
||||||
// Approximate overall context based on the first gradle invocation in the Job
|
|
||||||
const args = core.getInput('arguments')
|
|
||||||
const buildRootDirectory = core.getInput('build-root-directory')
|
|
||||||
const gradleVersion = core.getInput('gradle-version')
|
|
||||||
|
|
||||||
return hashStrings([javaHome, args, buildRootDirectory, gradleVersion])
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export function hashStrings(values: string[]): string {
|
export function hashStrings(values: string[]): string {
|
||||||
|
|
|
@ -16,6 +16,7 @@ export async function run(): Promise<void> {
|
||||||
|
|
||||||
try {
|
try {
|
||||||
const args: string[] = parseCommandLineArguments()
|
const args: string[] = parseCommandLineArguments()
|
||||||
|
// TODO: instead of running with no-daemon, run `--stop` in post action.
|
||||||
args.push('--no-daemon')
|
args.push('--no-daemon')
|
||||||
|
|
||||||
const result = await execution.execute(
|
const result = await execution.execute(
|
||||||
|
|
Loading…
Reference in a new issue