1
0
mirror of https://github.com/pnpm/action-setup.git synced 2026-03-01 07:51:02 +08:00
action-setup/src/cache-save/run.ts
khai96_ f6cc97e7f4 style: format
* no semicolons
* no star imports
* import order
2025-12-06 11:09:20 +07:00

19 lines
541 B
TypeScript

import { saveCache } from '@actions/cache'
import { getState, info } from '@actions/core'
export async function runSaveCache() {
const state = getState('cache_restored_key')
const primaryKey = getState('cache_primary_key')
const cachePath = getState('cache_path')
if (primaryKey === state) {
info(`Cache hit occurred on the primary key ${primaryKey}, not saving cache.`)
return
}
const cacheId = await saveCache([cachePath], primaryKey)
if (cacheId == -1) return
info(`Cache saved with the key: ${primaryKey}`)
}