mirror of
https://github.com/pnpm/action-setup.git
synced 2026-06-27 07:28:11 +00:00
fix: skip cache save when path is missing
This commit is contained in:
parent
0e279bb959
commit
49997ca1d7
BIN
dist/index.js
vendored
BIN
dist/index.js
vendored
Binary file not shown.
@ -1,5 +1,6 @@
|
|||||||
import { saveCache } from '@actions/cache'
|
import { saveCache } from '@actions/cache'
|
||||||
import { getState, info } from '@actions/core'
|
import { getState, info } from '@actions/core'
|
||||||
|
import { existsSync } from 'fs'
|
||||||
|
|
||||||
export async function runSaveCache() {
|
export async function runSaveCache() {
|
||||||
const state = getState('cache_restored_key')
|
const state = getState('cache_restored_key')
|
||||||
@ -11,6 +12,11 @@ export async function runSaveCache() {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!existsSync(cachePath)) {
|
||||||
|
info(`Cache path ${cachePath} does not exist, not saving cache.`)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
const cacheId = await saveCache([cachePath], primaryKey)
|
const cacheId = await saveCache([cachePath], primaryKey)
|
||||||
if (cacheId == -1) return
|
if (cacheId == -1) return
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user