Skip to content

Commit

Permalink
Distinguish cache and tools-cache in log message (#282)
Browse files Browse the repository at this point in the history
  • Loading branch information
eifinger authored Jul 4, 2024
1 parent 7a63de0 commit 957d97b
Show file tree
Hide file tree
Showing 7 changed files with 23 additions and 19 deletions.
12 changes: 6 additions & 6 deletions dist/save-cache/index.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion dist/save-cache/index.js.map

Large diffs are not rendered by default.

8 changes: 4 additions & 4 deletions dist/setup/index.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion dist/setup/index.js.map

Large diffs are not rendered by default.

10 changes: 7 additions & 3 deletions src/restore-cache.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ export async function restoreCache(
}

let matchedKey: string | undefined
core.info(`Trying to restore cache with key: ${cacheKey}`)
core.info(`Trying to restore .venv from cache with key: ${cacheKey}`)
try {
matchedKey = cacheLocalStoragePath
? await restoreCacheLocal(cacheKey)
Expand Down Expand Up @@ -63,10 +63,14 @@ function handleMatchResult(
): void {
if (matchedKey) {
core.saveState(STATE_CACHE_MATCHED_KEY, matchedKey)
core.info(`Cache restored from key: ${matchedKey}`)
core.info(
`.venv restored from${cacheLocalStoragePath ? ' local' : ''} cache with key: ${matchedKey}`
)
core.setOutput('cache-hit', true)
} else {
core.info(`No cache found for key: ${primaryKey}`)
core.info(
`No${cacheLocalStoragePath ? ' local' : ''} cache found for key: ${primaryKey}`
)
core.setOutput('cache-hit', false)
}
}
Expand Down
6 changes: 3 additions & 3 deletions src/save-cache.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,19 +42,19 @@ async function saveCache(): Promise<void> {
const matchedKey = core.getState(STATE_CACHE_MATCHED_KEY)

if (!cacheKey) {
core.warning('Error retrieving key from state.')
core.warning('Error retrieving cache key from state.')
return
} else if (matchedKey === cacheKey) {
// no change in target directories
core.info(`Cache hit occurred on key ${cacheKey}, not saving cache.`)
core.info(`Cache hit occurred on key ${cacheKey}, not saving .venv.`)
return
}
core.info(`Saving .venv path: ${venvPath}`)
cacheLocalStoragePath
? await saveCacheLocal(cacheKey)
: await cache.saveCache([venvPath], cacheKey)

core.info(`Cache saved with the key: ${cacheKey}`)
core.info(`.venv saved with the key: ${cacheKey}`)
}

async function saveCacheLocal(cacheKey: string): Promise<void> {
Expand Down
2 changes: 1 addition & 1 deletion src/setup-rye.ts
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ async function setupRye(
version = versionInput
installedPath = tryGetFromCache(arch, versionInput)
if (installedPath) {
core.info(`Found Rye in cache for ${versionInput}`)
core.info(`Found Rye in tools-cache for ${versionInput}`)
return {version, installedPath}
}
downloadPath = await downloadVersion(
Expand Down

0 comments on commit 957d97b

Please sign in to comment.