File tree 2 files changed +8
-7
lines changed 2 files changed +8
-7
lines changed Original file line number Diff line number Diff line change 1
1
import * as core from '@actions/core' ;
2
2
import * as cache from '@actions/cache' ;
3
+ import fs from 'fs' ;
3
4
import { State } from './constants' ;
4
5
import { getCacheDirectoryPath , getPackageManagerInfo } from './cache-utils' ;
5
6
@@ -26,6 +27,13 @@ const cachePackages = async (packageManager: string) => {
26
27
packageManagerInfo ,
27
28
packageManager
28
29
) ;
30
+
31
+ if ( ! fs . existsSync ( cachePath ) ) {
32
+ throw new Error (
33
+ `Cache folder path is retrieved for ${ packageManager } but doesn't exist on disk: ${ cachePath } `
34
+ ) ;
35
+ }
36
+
29
37
if ( primaryKey === state ) {
30
38
core . info (
31
39
`Cache hit occurred on the primary key ${ primaryKey } , not saving cache.`
Original file line number Diff line number Diff line change 1
1
import * as core from '@actions/core' ;
2
2
import * as exec from '@actions/exec' ;
3
- import fs from 'fs' ;
4
3
import os from 'os' ;
5
4
import path from 'path' ;
6
5
@@ -98,11 +97,5 @@ export const getCacheDirectoryPath = async (
98
97
99
98
core . debug ( `${ packageManager } path is ${ stdOut } ` ) ;
100
99
101
- if ( ! fs . existsSync ( stdOut ) ) {
102
- throw new Error (
103
- `Cache folder path is retrieved for ${ packageManager } but doesn't exist on disk: ${ stdOut } `
104
- ) ;
105
- }
106
-
107
100
return stdOut ;
108
101
} ;
You can’t perform that action at this time.
0 commit comments