@@ -5,17 +5,17 @@ const core = require('@actions/core')
55
66function init ( cacheConfig ) {
77 core . startGroup ( `Computing initial ${ cacheConfig . name } cache hash` )
8- fs . writeFileSync ( cacheConfig . path + '.sha256' , computeCacheHash ( cacheConfig . path ) )
8+ fs . writeFileSync ( cacheConfig . paths [ 0 ] + '.sha256' , computeCacheHash ( cacheConfig . paths [ 0 ] ) )
99 core . endGroup ( )
1010}
1111
1212function run ( cacheConfig ) {
13- if ( ! fs . existsSync ( cacheConfig . path ) ) {
13+ if ( ! fs . existsSync ( cacheConfig . paths [ 0 ] ) ) {
1414 core . warning ( `No ${ cacheConfig . name } cache present` )
1515 return
1616 }
1717
18- const files = fs . readdirSync ( cacheConfig . path , { withFileTypes : true , recursive : true } )
18+ const files = fs . readdirSync ( cacheConfig . paths [ 0 ] , { withFileTypes : true , recursive : true } )
1919 . filter ( d => d . isFile ( ) )
2020 . map ( d => {
2121 const file = path . join ( d . path , d . name )
@@ -44,18 +44,18 @@ function run(cacheConfig) {
4444
4545function cacheChanged ( cacheConfig ) {
4646 core . startGroup ( `Checking ${ cacheConfig . name } cache for changes` )
47- const hash = computeCacheHash ( cacheConfig . path )
48- const changed = fs . readFileSync ( cacheConfig . path + '.sha256' ) != hash
47+ const hash = computeCacheHash ( cacheConfig . paths [ 0 ] )
48+ const changed = fs . readFileSync ( cacheConfig . paths [ 0 ] + '.sha256' ) != hash
4949 core . info ( `Cache has changes: ${ changed } ` )
5050 core . endGroup ( )
5151 return changed ? hash : undefined
5252}
5353
54- function computeCacheHash ( path ) {
54+ function computeCacheHash ( cachePath ) {
5555 let hash = crypto . createHash ( 'sha256' )
5656
57- if ( fs . existsSync ( path ) ) {
58- const files = fs . readdirSync ( path , { withFileTypes : true , recursive : true } )
57+ if ( fs . existsSync ( cachePath ) ) {
58+ const files = fs . readdirSync ( cachePath , { withFileTypes : true , recursive : true } )
5959 . filter ( d => d . isFile ( ) )
6060 . map ( d => d . path )
6161 . sort ( )
0 commit comments