mirror of
				https://github.com/gradle/gradle-build-action.git
				synced 2025-11-04 18:08:57 +08:00 
			
		
		
		
	Use current matrix values for workflow job context
This commit is contained in:
		@@ -51,16 +51,9 @@ function generateCacheKey(cacheName: string): CacheKey {
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
function determineJobContext(): string {
 | 
			
		||||
    // Ideally we'd serialize the entire matrix values here, but matrix is not available within the action invocation.
 | 
			
		||||
    // Use the JAVA_HOME value as a proxy for the java version
 | 
			
		||||
    const javaHome = process.env['JAVA_HOME'] || ''
 | 
			
		||||
 | 
			
		||||
    // 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])
 | 
			
		||||
    // By default, we hash the full `matrix` data for the run, to uniquely identify this job invocation
 | 
			
		||||
    const workflowJobContext = core.getInput('workflow-job-context')
 | 
			
		||||
    return hashStrings([workflowJobContext])
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
export function hashStrings(values: string[]): string {
 | 
			
		||||
 
 | 
			
		||||
@@ -16,6 +16,7 @@ export async function run(): Promise<void> {
 | 
			
		||||
 | 
			
		||||
    try {
 | 
			
		||||
        const args: string[] = parseCommandLineArguments()
 | 
			
		||||
        // TODO: instead of running with no-daemon, run `--stop` in post action.
 | 
			
		||||
        args.push('--no-daemon')
 | 
			
		||||
 | 
			
		||||
        const result = await execution.execute(
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user