File tree 1 file changed +15
-3
lines changed
1 file changed +15
-3
lines changed Original file line number Diff line number Diff line change
1
+ const fs = require ( 'fs' ) . promises ;
1
2
const core = require ( '@actions/core' ) ;
2
3
const github = require ( '@actions/github' ) ;
3
4
const cache = require ( '@actions/cache' ) ;
@@ -6,9 +7,20 @@ const common = require('./common');
6
7
async function main ( ) {
7
8
try {
8
9
if ( core . getBooleanInput ( 'use-cache' ) ) {
9
- const prefix = await common . getCachePrefix ( ) ;
10
- const name = prefix + github . context . runId ;
11
- await cache . saveCache ( [ await common . getZigCachePath ( ) ] , name ) ;
10
+ const cache_path = await common . getZigCachePath ( ) ;
11
+
12
+ let accessible = true ;
13
+ try {
14
+ await fs . access ( cache_path , fs . constants . R_OK ) ;
15
+ } catch {
16
+ accessible = false ;
17
+ }
18
+
19
+ if ( accessible ) {
20
+ const prefix = await common . getCachePrefix ( ) ;
21
+ const name = prefix + github . context . runId ;
22
+ await cache . saveCache ( [ cache_path ] , name ) ;
23
+ }
12
24
}
13
25
} catch ( err ) {
14
26
core . setFailed ( err . message ) ;
You can’t perform that action at this time.
0 commit comments