File tree 4 files changed +24
-12
lines changed
4 files changed +24
-12
lines changed Original file line number Diff line number Diff line change @@ -61879,9 +61879,10 @@ const core = __nccwpck_require__(4147)
61879
61879
61880
61880
async function saveCache () {
61881
61881
const useCache = core.getInput('cache')
61882
- if (!useCache || !core.getState('restoreSucceded')) return
61883
-
61884
61882
const key = core.getState('key')
61883
+
61884
+ if (!useCache || key === '') return
61885
+
61885
61886
console.log(`Saving install with key ${key}`)
61886
61887
await cache.saveCache(['/opt/intel/oneapi'], key)
61887
61888
}
Original file line number Diff line number Diff line change @@ -62889,12 +62889,17 @@ async function restoreCache (components) {
62889
62889
}
62890
62890
key = key.substring(1)
62891
62891
console.log(`Key ${key}`)
62892
- core.saveState('key', key)
62893
62892
62894
62893
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
+ }
62898
62903
}
62899
62904
62900
62905
async function cleanupInstall () {
Original file line number Diff line number Diff line change @@ -3,9 +3,10 @@ const core = require('@actions/core')
3
3
4
4
async function saveCache ( ) {
5
5
const useCache = core . getInput ( 'cache' )
6
- if ( ! useCache || ! core . getState ( 'restoreSucceded' ) ) return
7
-
8
6
const key = core . getState ( 'key' )
7
+
8
+ if ( ! useCache || key === '' ) return
9
+
9
10
console . log ( `Saving install with key ${ key } ` )
10
11
await cache . saveCache ( [ '/opt/intel/oneapi' ] , key )
11
12
}
Original file line number Diff line number Diff line change @@ -32,12 +32,17 @@ async function restoreCache (components) {
32
32
}
33
33
key = key . substring ( 1 )
34
34
console . log ( `Key ${ key } ` )
35
- core . saveState ( 'key' , key )
36
35
37
36
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
+ }
41
46
}
42
47
43
48
async function cleanupInstall ( ) {
You can’t perform that action at this time.
0 commit comments