Minor improvement to logging in post-action

- Ensure that "Caching Gradle state" group always has 1 message
- Only print cache report when entries were restored or saved
This commit is contained in:
Daz DeBoer 2021-11-05 08:35:45 -06:00
parent 4e899835b3
commit 4137be6a8b
No known key found for this signature in database
GPG key ID: DD6B9F0B06683D5D
6 changed files with 10 additions and 6 deletions

2
dist/main/index.js vendored

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

2
dist/post/index.js vendored

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View file

@ -185,7 +185,7 @@ export abstract class AbstractCache {
async save(listener: CacheListener): Promise<void> {
if (!this.cacheOutputExists()) {
this.debug(`No ${this.cacheDescription} to cache.`)
core.info(`No ${this.cacheDescription} to cache.`)
return
}
@ -193,7 +193,7 @@ export abstract class AbstractCache {
const cacheResult = core.getState(this.cacheResultStateKey)
if (!cacheKey) {
this.debug(`${this.cacheDescription} existed prior to cache restore. Not saving.`)
core.info(`${this.cacheDescription} existed prior to cache restore. Not saving.`)
return
}

View file

@ -54,6 +54,10 @@ export async function save(): Promise<void> {
}
function logCachingReport(listener: CacheListener): void {
if (listener.cacheEntries.length === 0) {
return
}
core.info(`---------- Caching Summary -------------
Restored Entries Count: ${getCount(listener.cacheEntries, e => e.restoredSize)}
Size: ${getSum(listener.cacheEntries, e => e.restoredSize)}