fix: skip cache save when path is missing

This commit is contained in:
Etienne Martin 2026-06-11 19:09:16 +01:00
parent 0e279bb959
commit 49997ca1d7
2 changed files with 6 additions and 0 deletions

BIN
dist/index.js vendored

Binary file not shown.

View File

@ -1,5 +1,6 @@
import { saveCache } from '@actions/cache'
import { getState, info } from '@actions/core'
import { existsSync } from 'fs'
export async function runSaveCache() {
const state = getState('cache_restored_key')
@ -11,6 +12,11 @@ export async function runSaveCache() {
return
}
if (!existsSync(cachePath)) {
info(`Cache path ${cachePath} does not exist, not saving cache.`)
return
}
const cacheId = await saveCache([cachePath], primaryKey)
if (cacheId == -1) return