feat: store caching (#188)
* add pnpm store caching * style: format * no semicolons * no star imports * import order * style: no star imports --------- Co-authored-by: khai96_ <hvksmr1996@gmail.com>
This commit is contained in:
parent
ee7b8711bd
commit
e94b270858
11 changed files with 738 additions and 14 deletions
18
src/cache-save/run.ts
Normal file
18
src/cache-save/run.ts
Normal file
|
|
@ -0,0 +1,18 @@
|
|||
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}`)
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue