mirror of
				https://github.com/gradle/gradle-build-action.git
				synced 2025-11-04 09:58:56 +08:00 
			
		
		
		
	Improve formatting for cache entry size reporting
This commit is contained in:
		@@ -34,9 +34,9 @@ export class GradleUserHomeCache extends AbstractCache {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
    async restore(): Promise<void> {
 | 
					    async restore(): Promise<void> {
 | 
				
			||||||
        await super.restore()
 | 
					        await super.restore()
 | 
				
			||||||
        await this.reportCacheEntrySize('excluding common artifacts')
 | 
					        await this.reportCacheEntrySize('as restored from cache')
 | 
				
			||||||
        await this.restoreCommonArtifacts()
 | 
					        await this.restoreCommonArtifacts()
 | 
				
			||||||
        await this.reportCacheEntrySize('including common artifacts')
 | 
					        await this.reportCacheEntrySize('after restoring common artifacts')
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    private async restoreCommonArtifacts(): Promise<void> {
 | 
					    private async restoreCommonArtifacts(): Promise<void> {
 | 
				
			||||||
@@ -91,11 +91,30 @@ export class GradleUserHomeCache extends AbstractCache {
 | 
				
			|||||||
        if (!fs.existsSync(gradleUserHome)) {
 | 
					        if (!fs.existsSync(gradleUserHome)) {
 | 
				
			||||||
            return
 | 
					            return
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
        core.info(`Gradle User Home cache entry: ${label}`)
 | 
					        const result = await exec.getExecOutput(
 | 
				
			||||||
        await exec.exec('du', ['-h', '-c', '-t', '5M'], {
 | 
					            'du',
 | 
				
			||||||
            cwd: gradleUserHome,
 | 
					            ['-h', '-c', '-t', '5M'],
 | 
				
			||||||
            ignoreReturnCode: true
 | 
					            {
 | 
				
			||||||
        })
 | 
					                cwd: gradleUserHome,
 | 
				
			||||||
 | 
					                silent: true,
 | 
				
			||||||
 | 
					                ignoreReturnCode: true
 | 
				
			||||||
 | 
					            }
 | 
				
			||||||
 | 
					        )
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        core.info(`Gradle User Home cache entry (directories >5M): ${label}`)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        core.info(
 | 
				
			||||||
 | 
					            result.stdout
 | 
				
			||||||
 | 
					                .trimEnd()
 | 
				
			||||||
 | 
					                .replace(/\t/g, '    ')
 | 
				
			||||||
 | 
					                .split('\n')
 | 
				
			||||||
 | 
					                .map(it => {
 | 
				
			||||||
 | 
					                    return `  ${it}`
 | 
				
			||||||
 | 
					                })
 | 
				
			||||||
 | 
					                .join('\n')
 | 
				
			||||||
 | 
					        )
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        core.info('-----------------------')
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    async save(): Promise<void> {
 | 
					    async save(): Promise<void> {
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user