Skip to content

Commit

Permalink
Improve logging
Browse files Browse the repository at this point in the history
  • Loading branch information
bigdaz committed Aug 1, 2024
1 parent 45b944d commit e0d2343
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 11 deletions.
4 changes: 1 addition & 3 deletions sources/src/caching/cache-cleaner.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,6 @@ export class CacheCleaner {

// Visible for testing
async forceCleanupFilesOlderThan(cleanTimestamp: string): Promise<void> {
core.info(`Cleaning up caches before ${cleanTimestamp}`)

// Run a dummy Gradle build to trigger cache cleanup
const cleanupProjectDir = path.resolve(this.tmpDir, 'dummy-cleanup-project')
fs.mkdirSync(cleanupProjectDir, {recursive: true})
Expand Down Expand Up @@ -59,7 +57,7 @@ export class CacheCleaner {

const executable = await provisioner.provisionGradle('current')

await core.group('Executing Gradle build to clean up caches', async () => {
await core.group(`Executing Gradle to clean up caches before ${cleanTimestamp}`, async () => {
await this.executeCleanupBuild(executable!, cleanupProjectDir)
})
}
Expand Down
14 changes: 6 additions & 8 deletions sources/src/caching/caches.ts
Original file line number Diff line number Diff line change
Expand Up @@ -115,12 +115,10 @@ export async function save(
}

async function performCacheCleanup(gradleUserHome: string): Promise<void> {
await core.group('Performing cache cleanup', async () => {
const cacheCleaner = new CacheCleaner(gradleUserHome, process.env['RUNNER_TEMP']!)
try {
await cacheCleaner.forceCleanup()
} catch (e) {
core.warning(`Cache cleanup failed. Will continue. ${String(e)}`)
}
})
const cacheCleaner = new CacheCleaner(gradleUserHome, process.env['RUNNER_TEMP']!)
try {
await cacheCleaner.forceCleanup()
} catch (e) {
core.warning(`Cache cleanup failed. Will continue. ${String(e)}`)
}
}

0 comments on commit e0d2343

Please # to comment.