Skip to content

Commit 45ac66a

Browse files
committed
update
1 parent 449d716 commit 45ac66a

File tree

4 files changed

+24
-12
lines changed

4 files changed

+24
-12
lines changed

dist/cleanup/index.js

+3-2
Original file line numberDiff line numberDiff line change
@@ -61879,9 +61879,10 @@ const core = __nccwpck_require__(4147)
6187961879

6188061880
async function saveCache () {
6188161881
const useCache = core.getInput('cache')
61882-
if (!useCache || !core.getState('restoreSucceded')) return
61883-
6188461882
const key = core.getState('key')
61883+
61884+
if (!useCache || key === '') return
61885+
6188561886
console.log(`Saving install with key ${key}`)
6188661887
await cache.saveCache(['/opt/intel/oneapi'], key)
6188761888
}

dist/main/index.js

+9-4
Original file line numberDiff line numberDiff line change
@@ -62889,12 +62889,17 @@ async function restoreCache (components) {
6288962889
}
6289062890
key = key.substring(1)
6289162891
console.log(`Key ${key}`)
62892-
core.saveState('key', key)
6289362892

6289462893
console.log('Restoring from cache')
62895-
const success = await cache.restoreCache(['/opt/intel/oneapi'], key)
62896-
core.saveState('restoreSucceeded', success)
62897-
return success
62894+
const restoreKey = await cache.restoreCache(['/opt/intel/oneapi'], key)
62895+
console.log(`restoreKey ${restoreKey}`)
62896+
if (restoreKey) {
62897+
core.saveState('key', '')
62898+
return true
62899+
} else {
62900+
core.saveState('key', key)
62901+
return false
62902+
}
6289862903
}
6289962904

6290062905
async function cleanupInstall () {

src/cleanup.js

+3-2
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,10 @@ const core = require('@actions/core')
33

44
async function saveCache () {
55
const useCache = core.getInput('cache')
6-
if (!useCache || !core.getState('restoreSucceded')) return
7-
86
const key = core.getState('key')
7+
8+
if (!useCache || key === '') return
9+
910
console.log(`Saving install with key ${key}`)
1011
await cache.saveCache(['/opt/intel/oneapi'], key)
1112
}

src/main.js

+9-4
Original file line numberDiff line numberDiff line change
@@ -32,12 +32,17 @@ async function restoreCache (components) {
3232
}
3333
key = key.substring(1)
3434
console.log(`Key ${key}`)
35-
core.saveState('key', key)
3635

3736
console.log('Restoring from cache')
38-
const success = await cache.restoreCache(['/opt/intel/oneapi'], key)
39-
core.saveState('restoreSucceeded', success)
40-
return success
37+
const restoreKey = await cache.restoreCache(['/opt/intel/oneapi'], key)
38+
console.log(`restoreKey ${restoreKey}`)
39+
if (restoreKey) {
40+
core.saveState('key', '')
41+
return true
42+
} else {
43+
core.saveState('key', key)
44+
return false
45+
}
4146
}
4247

4348
async function cleanupInstall () {

0 commit comments

Comments
 (0)